Responses
Create OpenAI Responses API requests against Baseten Model APIs, including streaming, function tools, and structured outputs.
https://inference.baseten.co/v1/responses. Use it for the OpenAI Agents SDK and other clients built on the Responses API. Requests are stateless: send the full conversation as input on every call.
Call with the OpenAI SDK
Point the OpenAI client at Baseten and callresponses.create:
- Python
- JavaScript
- cURL
client from this section. The SDK convenience property output_text collects text from output items; the raw JSON response contains output, not an output_text field. Check status before treating that text as a complete answer.
Use with the OpenAI Agents SDK
Configure the Agents SDK to use the Responses API, then pass the model as anOpenAIResponsesModel. Agent model names are parsed as <provider>/<model> strings, so a Baseten slug such as zai-org/GLM-5.3 fails with Unknown prefix: zai-org if you pass it as a string. Build the model object instead:
Runner.run and Runner.run_streamed.
Requests are stateless
Baseten stores no response and exposes no retrieval endpoint, so a request can’t refer to an earlier response. Keep the original input, append all responseoutput items, then append the next user turn. Resend instructions on each request when you use them.
To continue a conversation:
Stream responses
Setstream to receive server-sent events. Text arrives as response.output_text.delta. The terminal response can be response.completed, response.incomplete, or response.failed; an error event or a connection that ends before a terminal response also needs error handling.
For a complete request and output, including terminal-status and interrupted-stream checks, see Stream responses and choose Responses.
Call function tools
Declare function tools intools. Each function_call output item contains name, JSON-encoded arguments, and a call_id. Execute every call, preserve all output items, and append a function_call_output with the matching call_id for each result. Keep the earlier input turns too.
A response can contain no calls or several parallel calls. Check its status and any refusal before treating a response without calls as final text. The model may request more tools after receiving results, so continue until it returns a complete answer.
For the complete request, tool results, and continuation loop, see Function calling and choose Responses.
Return structured output
Settext.format to a JSON schema to constrain the message text:
Unsupported fields
Baseten serves Responses statelessly, so fields that depend on stored state aren’t supported. The endpoint rejects requests that setprevious_response_id, conversation, background, or prompt with HTTP 501; send the full prompt and prior turns as input instead.
The endpoint accepts store, but there is no GET /v1/responses/{id} to retrieve a stored response. Store the response yourself if you need to refer to it later.Authorizations
A Baseten API key.
Body
Model slug, such as zai-org/GLM-5.3.
A prompt string, or the full conversation as input items. Include prior user messages, all response output items, and a function_call_output for each application function call.
System-level instructions for the request.
Upper bound on generated tokens, including reasoning tokens.
x >= 1Sampling temperature, from 0 to 2.
0 <= x <= 2Nucleus sampling threshold, from 0 to 1.
0 <= x <= 1Stream server-sent events instead of returning one JSON object.
Function tools the model can call.
Whether the model calls a tool. auto lets the model decide, required forces a call, none forbids one.
auto, required, none Lets the model emit more than one function call in a response.
Output format for the message text.
Reasoning settings for models that expose them.
Up to 16 key-value pairs, echoed back on the response.
auto or disabled.
auto, disabled Response
A response, which can be completed, incomplete, or failed; or a server-sent event stream when stream is true. Inspect the outcome before using the output.
Response identifier, prefixed resp_.
response completed, incomplete, failed, in_progress Output items in the order the model produced them.
- Option 1
- Option 2
- Option 3