mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-05 08:07:05 +00:00
docs(openai): move chat-to-responses flag docs to openai.md completions section
- Add route_all_chat_openai_to_responses global flag docs under 'Getting Reasoning Content in /chat/completions' in openai.md with SDK and proxy examples using gpt-5.4 - Remove the section from responses_api.md (wrong location) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bbcfabe08a
commit
aabb543f58
2 changed files with 50 additions and 40 deletions
|
|
@ -434,7 +434,56 @@ curl -X POST 'http://0.0.0.0:4000/chat/completions' \
|
|||
|
||||
## Getting Reasoning Content in `/chat/completions`
|
||||
|
||||
GPT-5 models return reasoning content when called via the Responses API. You can call these models via the `/chat/completions` endpoint by using the `openai/responses/` prefix.
|
||||
GPT-5 models return reasoning content when called via the Responses API. You can call these models via the `/chat/completions` endpoint in two ways:
|
||||
|
||||
**Option A — per-request prefix:** Use the `openai/responses/` model prefix.
|
||||
|
||||
**Option B — global flag (recommended):** Set `route_all_chat_openai_to_responses = True` to automatically route all OpenAI `/chat/completions` requests through the Responses API, no model prefix needed.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="sdk-global" label="SDK - Global Flag">
|
||||
|
||||
```python
|
||||
import litellm
|
||||
|
||||
litellm.route_all_chat_openai_to_responses = True
|
||||
|
||||
response = litellm.completion(
|
||||
model="gpt-5.4",
|
||||
messages=[{"role": "user", "content": "What is the capital of France?"}],
|
||||
reasoning_effort="low",
|
||||
)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="proxy-global" label="PROXY - Global Flag">
|
||||
|
||||
Set in your proxy config:
|
||||
```yaml
|
||||
litellm_settings:
|
||||
route_all_chat_openai_to_responses: true
|
||||
```
|
||||
|
||||
Then call normally — no model prefix needed:
|
||||
```bash
|
||||
curl -X POST 'http://0.0.0.0:4000/chat/completions' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-d '{
|
||||
"model": "gpt-5.4",
|
||||
"messages": [{"role": "user", "content": "What is the capital of France?"}],
|
||||
"reasoning_effort": "low"
|
||||
}'
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::note
|
||||
`route_all_chat_openai_to_responses` only applies to the `openai` provider. Azure OpenAI is unaffected. You can also set it via env var: `LITELLM_ROUTE_ALL_CHAT_OPENAI_TO_RESPONSES=true`.
|
||||
:::
|
||||
|
||||
**Option A — per-request prefix:** You can also prefix individual model names with `openai/responses/` to route just that call through the Responses API.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="sdk" label="SDK">
|
||||
|
|
|
|||
|
|
@ -923,45 +923,6 @@ curl http://localhost:4000/v1/chat/completions \
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Route all OpenAI chat completions through the Responses API (recommended)
|
||||
|
||||
Instead of prefixing each model with `openai/responses/`, you can enable a global flag to automatically route **all** `/chat/completions` requests for OpenAI models through the Responses API bridge. This is the recommended approach for OpenAI models.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="sdk" label="LiteLLM Python SDK">
|
||||
|
||||
```python showLineNumbers title="Global flag - route all OpenAI completions via Responses API"
|
||||
import litellm
|
||||
|
||||
litellm.route_all_chat_openai_to_responses = True
|
||||
|
||||
response = litellm.completion(
|
||||
model="gpt-4o",
|
||||
messages=[{"role": "user", "content": "Hello!"}],
|
||||
)
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="proxy" label="LiteLLM Proxy">
|
||||
|
||||
```yaml showLineNumbers title="proxy_config.yaml"
|
||||
litellm_settings:
|
||||
route_all_chat_openai_to_responses: true
|
||||
```
|
||||
|
||||
Or set via environment variable:
|
||||
|
||||
```bash
|
||||
LITELLM_ROUTE_ALL_CHAT_OPENAI_TO_RESPONSES=true
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
:::note
|
||||
This flag only applies to the `openai` provider. Azure OpenAI and other providers are unaffected.
|
||||
:::
|
||||
|
||||
## Free-form Function Calling
|
||||
|
||||
<Tabs>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue