Skip to content

Create Response

client.responses.create(params)
POST/v1/responses

Create an OpenAI-compatible model response. SandBase preserves request fields after model mapping, then sanitizes responses to public OpenAI fields.

Request body

ResponseCreateParams
stringmodelrequired

Model identifier from the Models API.

Optional<string | object[]>input

Text, message items, or other input supported by the selected model and provider.

Optional<string>instructions

System or developer instruction for the response.

Optional<boolean>stream

Return OpenAI-compatible Server-Sent Events.

Default: false

Optional<boolean>background

Request background execution when supported by the selected provider.

Optional<string[]>include

Additional public response data to include when supported.

Optional<integer>max_output_tokens

Maximum generated tokens.

Optional<integer>max_tool_calls

Maximum built-in tool calls when supported.

Optional<object>metadata

Request metadata forwarded to the provider.

Optional<boolean>parallel_tool_calls

Allow supported models to invoke tools in parallel.

Optional<string>previous_response_id

Previous response to continue when supported by the selected route.

Optional<object>reasoning

Reasoning configuration for supported models.

Optional<boolean>store

Request provider-side response storage when supported.

Optional<object>text

Text output and structured-format configuration.

Optional<string | object>tool_choice

Controls tool selection.

Optional<object[]>tools

Tools available to the model.

Optional<string>truncation

Input truncation behavior.

Request compatibility

SandBase rewrites model to the selected upstream model and preserves other request fields. Provider support still varies.

Sanitized responses

Only public OpenAI response fields and token usage are returned. Provider billing, account, routing, and unknown top-level extensions are removed; output item content is preserved.

Streaming

Public response.* and error SSE events are sanitized and forwarded. Unknown private events are dropped; malformed data closes the stream rather than forwarding unsafe content.

Errors

400

Invalid JSON, missing model, or an invalid provider request.

401

Missing or invalid API key.

402

Organization or API Key spending limit reached.

403

API key scope or upstream permission rejection.

413

The upstream provider rejected the request as too large.

500

Prediction lifecycle or organization lookup failed.

502

The upstream response could not be safely parsed and sanitized.

503

Routing failed or every provider candidate was exhausted.