-
-
Notifications
You must be signed in to change notification settings - Fork 5k
docs: clarify when to use openai/responses/ prefix for built-in tools #17717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
docs: clarify when to use openai/responses/ prefix for built-in tools #17717
Conversation
The existing documentation for the Responses API bridge only showed examples with models that have `mode: responses` (like o3-deep-research), which work automatically. This update clarifies that models with `mode: chat` (like gpt-4o, gpt-5) require the `openai/responses/` prefix to use built-in tools like web_search_preview. Changes: - Explain the `mode` property from model_prices_and_context_window.json - List models with mode: responses vs mode: chat - Add example showing the common error and how to fix it - Add SDK example using the prefix with gpt-4o - Update proxy example with both automatic and prefix-based configs - Fix invalid trailing comma in original JSON example
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| ## OpenAI Chat Completion to Responses API Bridge | ||
|
|
||
| Call any Responses API model from OpenAI's `/chat/completions` endpoint. | ||
| Use OpenAI's [Responses API](https://platform.openai.com/docs/api-reference/responses) features (like `web_search_preview`, `code_interpreter`, and other built-in tools) through LiteLLM's `/chat/completions` endpoint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't write like this. This is too verbose and not very helpful to the user. I would instead use:
LiteLLM offers a chat completion to response API bridge mode. This mode lets you use the completion method interface while calling the OpenAI response API under the hood.
Using this bridge makes sense when you want to use response API specific features (like built-in tools, web search preview, or code interpreter) or when you need models that are only available through the response API.
How to force the use of the response API bridge
Use the 'openai/responses' prefix in the model name. For example:
response = litellm.completion( model="openai/responses/gpt-4o", tools=[{"type": "web_search_preview"}], # Supported in Responses API ... )
|
|
||
| ### When to use the `openai/responses/` prefix | ||
|
|
||
| Each model has a `mode` property defined in [`model_prices_and_context_window.json`](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) that determines which API endpoint it uses by default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is litellm internals, not helpful to the user. I would remove.
| - **`mode: responses`** - Model automatically uses the Responses API | ||
| - **`mode: chat`** - Model defaults to the Chat Completions API | ||
|
|
||
| **Models with `mode: responses`** (automatic Responses API): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is worth its own section under how to use response API. Say that when you call these models, the response API gets used automatically under the hood.
@krrishdholakia I would strongly recommend changing this behavior and making it opt-in through a parameter. See my comment here
|
Thanks for the PR @Chesars ! I have added a couple of comments. Overall I feel it's too verbose and not very well organized. I offered some possible edits. Note though that I am not a maintainer, so not sure what are the best practices / organization for the documentation! |
Relevant issues
#17583
Pre-Submission checklist
Type
📖 Documentation
Summary
The existing documentation for the Responses API bridge only showed examples with models that have
mode: responses(likeo3-deep-research), which work automatically. This update clarifies that models withmode: chat(likegpt-4o,gpt-5) require theopenai/responses/prefix to use built-in tools likeweb_search_preview.What's added:
modeproperty frommodel_prices_and_context_window.jsonmode: responsesvsmode: chatgpt-4oCurrent docs:
after: