openai.ResponsesClient
The OpenAI Responses API client (POST {base_url}/responses).
Signature
class openai.ResponsesClientThe OpenAI Responses API client (POST {base_url}/responses).
Options come in three groups:
- credentials/endpoint —
api_key/base_url(or the*_envnames read at request time); - first-class typed request parameters —
temperature,top_p,max_output_tokens,reasoning_effort,reasoning_summary,verbosity,parallel_tool_calls,store. Each one is lowered into the typed request class only when it is non-null; - passthrough —
request_body(deep-merged over the serialized typed request as the LAST step,nulldeletes a key),headersandquery_params.
Structured output stays SAP-based: the schema rides in the prompt text and
text.format is deliberately never set. A caller who
wants native JSON-schema output sets it through request_body.
Deliberately not provided: the engine's finish_reason_allow_list and
finish_reason_deny_list. There is no config surface for them here and
none is planned — the typed
ai.content.StopReason plus the runner's Refused / MaxTokens enforcement
covers what the lists were used for, and a caller who wants a stricter policy
writes it over the returned turn (or wraps the client) rather than
configuring a string list of provider finish reasons.
Source:<builtin>/openai/responses.bamlbytes 1349–7378
Fields
model
stringapi_key
ai.Credential | nullbase_url
ai.Credential | nullrequest_timeout_ms
int | nulltime_to_first_token_timeout_ms
int | nulltemperature
float | nulltop_p
float | nullmax_output_tokens
int | nullreasoning_effort
string | nullreasoning_summary
string | nullverbosity
string | nullparallel_tool_calls
bool | nullstore
boolrequest_body
baml.json.json | nullDeep-merged over the serialized typed request as the last step before
the body is stringified. A null value DELETES that key, so
{"store": null} drops the store: false this client sends.
headers
map<string, string> | nullExtra request headers, applied (lowercased) before authorization.
query_params
map<string, string> | nullExtra URL query parameters, percent-encoded onto the endpoint.
capture_wire
boolStatic methods
new
(Creates a client. Construction reads no environment variable, so declaring one is always safe; credentials and endpoints resolve when a request is built.
Instance methods
resolved_api_key
(The request-time credential: an explicit value (a literal, or the value
of the variable an env.NAME ref points at), else the provider's
canonical one. Nothing here runs before the request.
A missing key is a CATCHABLE configuration error, not a panic:
baml.env.get_or_panic unwinds past the catch_all +
ai.errors.normalize wrapper below, so an unset variable would take the
process down instead of surfacing as an ai.errors.Failure.
resolved_base_url
(self) -> string | null throws baml.errors.Io | baml.errors.ParseErrorThe request-time base URL, or null for the provider default.
Implementations
ai.Client for openai.ResponsesClient
Instance methods
id
(self) -> stringinvoke
(render
(Source:<builtin>/openai/responses.bamlbytes 6536–7086
ai.stream.StreamingClient for openai.ResponsesClient
Instance methods
invoke_stream
(Source:<builtin>/openai/responses.bamlbytes 7092–7376