Create response with OpenAI/Azure credentials

Send an OpenAI Responses API request through Respan provider passthrough. This endpoint currently routes to OpenAI direct by default, or Azure OpenAI when `X-Respan-Route-Provider: azure` is set. It requires OpenAI or Azure OpenAI provider credentials configured in Settings -> Providers, or supplied with `credential_override`. In the API reference auth field, enter your Respan API key. Paste the OpenAI or Azure OpenAI provider token in `credential_override.<model>.api_key`; a Respan API key with managed credits alone is not enough for this Responses API passthrough path today. For credit-backed gateway model calls with only a Respan API key, use `POST /api/chat/completions`. Respan-specific parameters can be passed three ways: 1. **Top-level body fields** - add directly to the request body 2. **Nested under `respan_params`** - explicit namespacing to avoid conflicts 3. **Header `X-Data-Respan-Params`** - base64-encoded JSON header Merge order: top-level body fields > `respan_params` > header. Legacy compatibility: - `keywordsai_params` is still accepted and merged into `respan_params` - `X-Data-Keywordsai-Params` is still accepted and auto-renamed internally

Authentication

AuthorizationBearer

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, OpenAI or Azure OpenAI provider credentials go in Settings -> Providers or the request body credential_override field, not in this auth field.

Headers

X-Data-Respan-ParamsstringOptional

Base64-encoded JSON object of Respan parameters. Legacy X-Data-Keywordsai-Params is still accepted.

X-Respan-Route-ProviderstringOptional

Pin the request to a specific provider without changing the model slug. Example: vertex_ai routes a claude-sonnet-4-5-20250929 request to Vertex AI Claude.

X-Respan-BetastringOptional

Comma-separated beta feature flags. Available: token-breakdown-2026-03-26, env-scoped-integrations-2026-03-28

Request

This endpoint expects an object.
modelstringRequired

OpenAI Responses API model to use. This passthrough path supports OpenAI direct by default and Azure OpenAI with X-Respan-Route-Provider: azure; use /api/chat/completions for credit-backed gateway calls with only a Respan API key.

inputstring or list of objectsRequired
Input text or array of conversation messages.
instructionsstringOptional
System instructions for the model.
streambooleanOptional

Stream the response as server-sent events.

temperaturedoubleOptional

Sampling temperature (0-2).

max_output_tokensintegerOptional
Maximum tokens to generate.
top_pdoubleOptional
Nucleus sampling parameter.
toolslist of objectsOptional
Tools the model may call.
previous_response_idstringOptional

ID of a previous response for multi-turn conversations.

fallback_modelslist of stringsOptional
Backup models if the primary model fails.
customer_credentialsobjectOptional

Per-customer LLM provider credentials.

credential_overrideobjectOptional
One-off OpenAI or Azure OpenAI provider credentials for this request. This is where you paste the provider token for /api/responses. Do not put your Respan API key here. For OpenAI direct, use `{ "gpt-4o-mini": { "api_key": "OPENAI_API_KEY" } }`. For Azure OpenAI, provide `api_key`, `api_base`, and `api_version` for the Azure-routed model.
cache_enabledbooleanOptional
Enable response caching.
cache_ttlintegerOptional

Cache TTL in seconds. Default: 30 days.

cache_optionsobjectOptional

Cache behavior options. Properties: cache_by_customer, is_cached_by_model, omit_log.

load_balance_groupobjectOptional

Load balance group selection. Use {"group_id": "..."} to route through a configured group.

request_breakdownbooleanOptional
Return response metrics summary in the response body. For streaming, metrics appear in the final chunk.
promptobjectOptional

Prompt template config. Properties: prompt_id (required), variables, version, echo. See Prompt management.

retry_paramsobjectOptional

Retry config. Properties: retry_enabled (boolean), num_retries, retry_after (seconds).

disable_logbooleanOptional

When true, omits input/output from the log. Metrics still recorded.

modelslist of stringsOptional
Model list for LLM router selection.
exclude_providerslist of stringsOptional
Providers to exclude from routing.
exclude_modelslist of stringsOptional
Models to exclude from routing.
metadataobjectOptional

Custom key-value metadata attached to the span.

custom_identifierstringOptional
Indexed custom tag for fast querying.
customer_identifierstringOptional
End user identifier for analytics and budgets.
customer_paramsobjectOptional

Extended customer info. Properties: customer_identifier (required), group_identifier, name, email, period_budget, budget_duration (daily/weekly/monthly), total_budget, markup_percentage.

thread_identifierstringOptional
Conversation thread ID.
positive_feedbackbooleanOptional

User feedback. true = liked, false = disliked.

propertiesobjectOptional
Typed metadata preserving native types.
respan_paramsobjectOptional
Namespaced container for all Respan parameters.

Response

Model response

Errors

400
Bad Request Error
401
Unauthorized Error
500
Internal Server Error