All skillsWhy
Python Example: Persist
Skillintermediate
index 60
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Claude Code Knowledge Pack7/10/2026
Overview
LiteLLM now supports GPT-5.3-Codex on Day 0, including support for the new assistant phase metadata on Responses API output items.
Why phase matters for GPT-5.3-Codex
phase appears on assistant output items and helps distinguish preamble/commentary turns from final closeout responses.
Reference: Phase parameter docs
Supported values:
null"commentary""final_answer"
Important:
- Persist assistant output items with
phaseexactly as returned. - Send those assistant items back on the next turn.
- Do not add
phaseto user messages.
Docker Image
docker pull ghcr.io/berriai/litellm:v1.81.12-stable.gpt-5.3
Usage
1. Setup config.yaml
model_list:
- model_name: gpt-5.3-codex
litellm_params:
model: openai/gpt-5.3-codex
2. Start the proxy
docker run -d \\
-p 4000:4000 \\
-e ANTHROPIC_API_KEY=$OPENAI_API_KEY \\
-v $(pwd)/config.yaml:/app/config.yaml \\
ghcr.io/berriai/litellm:v1.81.12-stable.gpt-5.3 \\
--config /app/config.yaml
3. Test it
curl -X POST "http://0.0.0.0:4000/v1/responses" \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer $LITELLM_KEY" \\
-d '{
"model": "gpt-5.3-codex",
"input": "Write a Python script that checks if a number is prime."
}'
Python Example: Persist phase with OpenAI Client + LiteLLM Base URL
from openai import OpenAI
client = OpenAI(
base_url="http://0.0.0.0:4000/v1", # LiteLLM Proxy
api_key="your-litellm-api-key",
)
items = [] # Persist this per conversation/thread
def _item_get(item, key, default=None):
if isinstance(item, dict):
return item.get(key, default)
return getattr(item, key, default)
def run_turn(user_text: str):
global items
# User message: no phase field
items.append(
{
"type": "message",
"role": "user",
"content": [{"type": "input_text", "text": user_text}],
}
)
resp = client.responses.create(
model="gpt-5.3-codex",
input=items,
)
# Persist assistant output items verbatim, including phase
for out_item in (resp.output or []):
items.append(out_item)
# Optional: inspect latest phase for UI/telemetry routing
latest_phase = None
for out_item in reversed(resp.output or []):
if _item_get(out_item, "type") == "output_item.done" and _item_get(out_item, "phase") is not None:
latest_phase = _item_get(out_item, "phase")
break
return resp, latest_phase
Notes
- Use
/v1/responsesfor GPT Codex models. - Preserve full assistant output history for best multi-turn behavior.
- If
phasemetadata is dropped during history reconstruction, output quality can degrade on long-running tasks.