Create a response
https://api.respan.ai/api/responsesCreates an OpenAI-compatible response through Respan. Choose the OpenAI, Azure, Perplexity, or Bedrock example. The OpenAI and Perplexity examples use Respan-managed routing when the model is available on credits; provider credentials can also be stored in Settings > Providers or supplied in respan_params.credential_override. For Azure, replace YOUR_AZURE_DEPLOYMENT, YOUR_RESOURCE and PROVIDER_API_KEY with your Azure deployment and credentials. Bedrock Responses requires your own AWS Bedrock credentials configured in Respan (BYOK); Respan credits are not supported for this route. Successful responses include X-Respan-Log-Id and are logged with the provider model and cost.
Servers
https://api.respan.ai: Respan API Server
Authentication
RespanApiKey
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, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.
HTTP scheme: bearer; format: Respan API key.
Authorization: Bearer $RESPAN_API_KEYHeaders
X-Respan-Route-Provider string OptionalAllowed:
"openai", "azure", "perplexity", "bedrock"Query parameters
format string Optional"json", "txt"Request body
A request body is required.
application/json
$ object Required body
customer_identifier may be sent at the request root or under respan_params; nested values win when both are present.Additional properties are allowed
model string Optionalmodels instead. Bedrock: use a bedrock-prefixed inference profile, such as bedrock/us.openai.gpt-6.1-sol.input string or array<any> Required in parent
input (oneOf 1) string Schema variantinput (oneOf 2) array<any> Schema variant
input (oneOf 2)[] any Array itemstream boolean OptionalDefault:
falsepreset string Optionalmedium. Send it with model or models: a preset alone fails Respan’s model validation.models array<string> Optional
models[] string Array itemmax_steps integer OptionalMinimum:
1language_preference string Optionalresponse_format object Optionalskills array<any> Optional
skills[] any Array itemtools array<any> Optional
tools[] any Array itemrespan_params object Optional
respan_params.credential_override object Optional
respan_params.credential_override.<key> object Map value
respan_params.credential_override.<key>.api_key string OptionalFormat:
passwordWrite only
respan_params.credential_override.<key>.api_base string Optionalrespan_params.credential_override.<key>.api_version string Optionalrespan_params.cache_enabled boolean Optionalrespan_params.cache_ttl number Optionalcache_ttl is served from the cache for at most 30 minutes.respan_params.cache_options object Optional
respan_params.cache_options.cache_by_customer boolean Optionalrespan_params.cache_options.is_cached_by_model boolean Optionalrespan_params.cache_options.omit_log boolean Optionalrespan_params.customer_identifier string Optionalcache_enabled boolean Optionalcache_ttl number Optionalcache_ttl is served from the cache for at most 30 minutes.cache_options object Optional
cache_options.cache_by_customer boolean Optionalcache_options.is_cached_by_model boolean Optionalcache_options.omit_log boolean Optionalcustomer_identifier string OptionalOpenAPI request schema
{
"type": "object",
"description": "OpenAI Responses API request. Standard Responses fields are accepted. Perplexity extensions are accepted only when X-Respan-Route-Provider is perplexity. Respan cache controls and `customer_identifier` may be sent at the request root or under `respan_params`; nested values win when both are present.",
"additionalProperties": true,
"properties": {
"model": {
"type": "string",
"description": "OpenAI: use a supported model such as gpt-6-luna. Azure: use azure/<your-deployment-name>. Perplexity: use a provider-prefixed model, such as perplexity/sonar, or send `models` instead. Bedrock: use a bedrock-prefixed inference profile, such as bedrock/us.openai.gpt-6.1-sol."
},
"input": {
"description": "Text or structured input for the response.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {}
}
]
},
"stream": {
"type": "boolean",
"default": false,
"description": "Return Responses API server-sent events when true."
},
"preset": {
"type": "string",
"description": "Perplexity Agent API preset, such as `medium`. Send it with `model` or `models`: a preset alone fails Respan's model validation."
},
"models": {
"type": "array",
"description": "Perplexity Agent API fallback model chain, tried in order.",
"items": {
"type": "string"
}
},
"max_steps": {
"type": "integer",
"minimum": 1,
"description": "Maximum Perplexity agent steps."
},
"language_preference": {
"type": "string",
"description": "Preferred response language for Perplexity Agent API."
},
"response_format": {
"type": "object",
"description": "Perplexity Agent API structured response configuration."
},
"skills": {
"type": "array",
"description": "Perplexity Agent API skills.",
"items": {}
},
"tools": {
"type": "array",
"description": "Response tools. Perplexity supports web_search with filters such as search_domain_filter.",
"items": {}
},
"respan_params": {
"type": "object",
"description": "Respan metadata, prompt configuration, customer identifiers, provider credentials, and other gateway parameters. route_provider_override here cannot activate the Perplexity route.",
"properties": {
"credential_override": {
"type": "object",
"description": "Request-scoped provider credentials. Named examples prefill the correct selector; keep that selector and replace only its credential values. OpenAI and Azure selectors exactly match model. Perplexity uses an empty-string selector because its credential is provider-scoped.",
"additionalProperties": {
"type": "object",
"additionalProperties": true,
"properties": {
"api_key": {
"type": "string",
"format": "password",
"writeOnly": true,
"description": "API key for the selected upstream provider, not your Respan API key. Enter the Respan key in the Authorization control."
},
"api_base": {
"type": "string",
"format": "uri",
"description": "Azure OpenAI resource endpoint, for example https://YOUR_RESOURCE.openai.azure.com."
},
"api_version": {
"type": "string",
"description": "Azure OpenAI API version. The Azure example prefills 2025-04-01-preview, which supports the Responses API."
}
}
}
},
"cache_enabled": {
"type": "boolean",
"description": "Enable response caching for this request."
},
"cache_ttl": {
"type": "number",
"description": "Cache lifetime in seconds. A response stored without `cache_ttl` is served from the cache for at most 30 minutes."
},
"cache_options": {
"type": "object",
"properties": {
"cache_by_customer": {
"type": "boolean"
},
"is_cached_by_model": {
"type": "boolean"
},
"omit_log": {
"type": "boolean"
}
},
"additionalProperties": false
},
"customer_identifier": {
"type": "string",
"description": "End-customer identifier used for logging and optional cache partitioning."
}
}
},
"cache_enabled": {
"type": "boolean",
"description": "Enable response caching for this request."
},
"cache_ttl": {
"type": "number",
"description": "Cache lifetime in seconds. A response stored without `cache_ttl` is served from the cache for at most 30 minutes."
},
"cache_options": {
"type": "object",
"properties": {
"cache_by_customer": {
"type": "boolean"
},
"is_cached_by_model": {
"type": "boolean"
},
"omit_log": {
"type": "boolean"
}
},
"additionalProperties": false
},
"customer_identifier": {
"type": "string",
"description": "End-customer identifier used for logging and optional cache partitioning."
}
},
"required": [
"input"
]
}Examples
openai
Headers
{
"X-Respan-Route-Provider": "openai",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
}Request
{
"model": "gpt-6-luna",
"input": "Reply with exactly ok.",
"max_output_tokens": 32,
"reasoning": {
"effort": "none"
},
"stream": false
}Response
{
"body": {
"id": "resp_openai_example",
"model": "gpt-6-luna",
"output": []
}
}cURL
curl --request POST 'https://api.respan.ai/api/responses' \
--header "Authorization: Bearer $RESPAN_API_KEY" \
--header 'X-Respan-Route-Provider: openai' \
--header 'Content-Type: application/json' \
--data @- <<'JSON'
{
"model": "gpt-6-luna",
"input": "Reply with exactly ok.",
"max_output_tokens": 32,
"reasoning": {
"effort": "none"
},
"stream": false
}
JSONPython
import json
import os
import urllib.request
payload = json.loads(r'''{
"model": "gpt-6-luna",
"input": "Reply with exactly ok.",
"max_output_tokens": 32,
"reasoning": {
"effort": "none"
},
"stream": false
}''')
request = urllib.request.Request(
"https://api.respan.ai/api/responses",
data=json.dumps(payload).encode(),
headers={
"Authorization": f"Bearer {os.environ['RESPAN_API_KEY']}",
"Content-Type": "application/json",
"X-Respan-Route-Provider": "openai",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.load(response))TypeScript
const response = await fetch("https://api.respan.ai/api/responses", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPAN_API_KEY}`,
"Content-Type": "application/json",
"X-Respan-Route-Provider": "openai",
},
body: JSON.stringify({
"model": "gpt-6-luna",
"input": "Reply with exactly ok.",
"max_output_tokens": 32,
"reasoning": {
"effort": "none"
},
"stream": false
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());Python SDK (respan-api)
import json
import os
from respan import RespanClient
client = RespanClient(respan_api_key=os.environ["RESPAN_API_KEY"])
payload = json.loads(r'''{
"model": "gpt-6-luna",
"input": "Reply with exactly ok.",
"max_output_tokens": 32,
"reasoning": {
"effort": "none"
},
"stream": false
}''')
response = client.gateway.create_response(
respan_route_provider="openai",
**payload,
)
print(response)TypeScript SDK (@respan/respan-api)
import { RespanClient } from "@respan/respan-api";
const apiKey = process.env.RESPAN_API_KEY!;
const client = new RespanClient({
respanApiKey: apiKey,
authorization: `Bearer ${apiKey}`,
});
const response = await client.gateway.createResponse({
"X-Respan-Route-Provider": "openai",
"model": "gpt-6-luna",
"input": "Reply with exactly ok.",
"max_output_tokens": 32,
"reasoning": {
"effort": "none"
},
"stream": false
});
console.log(response);azure
Headers
{
"X-Respan-Route-Provider": "azure",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
}Request
{
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"input": "Summarize the benefits of retrieval-augmented generation.",
"stream": false,
"respan_params": {
"credential_override": {
"azure/YOUR_AZURE_DEPLOYMENT": {
"api_key": "PROVIDER_API_KEY",
"api_base": "https://YOUR_RESOURCE.openai.azure.com",
"api_version": "2025-04-01-preview"
}
}
}
}Response
{
"body": {
"id": "resp_azure_example",
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"output": []
}
}cURL
curl --request POST 'https://api.respan.ai/api/responses' \
--header "Authorization: Bearer $RESPAN_API_KEY" \
--header 'X-Respan-Route-Provider: azure' \
--header 'Content-Type: application/json' \
--data @- <<'JSON'
{
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"input": "Summarize the benefits of retrieval-augmented generation.",
"stream": false,
"respan_params": {
"credential_override": {
"azure/YOUR_AZURE_DEPLOYMENT": {
"api_key": "PROVIDER_API_KEY",
"api_base": "https://YOUR_RESOURCE.openai.azure.com",
"api_version": "2025-04-01-preview"
}
}
}
}
JSONPython
import json
import os
import urllib.request
payload = json.loads(r'''{
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"input": "Summarize the benefits of retrieval-augmented generation.",
"stream": false,
"respan_params": {
"credential_override": {
"azure/YOUR_AZURE_DEPLOYMENT": {
"api_key": "PROVIDER_API_KEY",
"api_base": "https://YOUR_RESOURCE.openai.azure.com",
"api_version": "2025-04-01-preview"
}
}
}
}''')
request = urllib.request.Request(
"https://api.respan.ai/api/responses",
data=json.dumps(payload).encode(),
headers={
"Authorization": f"Bearer {os.environ['RESPAN_API_KEY']}",
"Content-Type": "application/json",
"X-Respan-Route-Provider": "azure",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.load(response))TypeScript
const response = await fetch("https://api.respan.ai/api/responses", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPAN_API_KEY}`,
"Content-Type": "application/json",
"X-Respan-Route-Provider": "azure",
},
body: JSON.stringify({
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"input": "Summarize the benefits of retrieval-augmented generation.",
"stream": false,
"respan_params": {
"credential_override": {
"azure/YOUR_AZURE_DEPLOYMENT": {
"api_key": "PROVIDER_API_KEY",
"api_base": "https://YOUR_RESOURCE.openai.azure.com",
"api_version": "2025-04-01-preview"
}
}
}
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());Python SDK (respan-api)
import json
import os
from respan import RespanClient
client = RespanClient(respan_api_key=os.environ["RESPAN_API_KEY"])
payload = json.loads(r'''{
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"input": "Summarize the benefits of retrieval-augmented generation.",
"stream": false,
"respan_params": {
"credential_override": {
"azure/YOUR_AZURE_DEPLOYMENT": {
"api_key": "PROVIDER_API_KEY",
"api_base": "https://YOUR_RESOURCE.openai.azure.com",
"api_version": "2025-04-01-preview"
}
}
}
}''')
response = client.gateway.create_response(
respan_route_provider="azure",
**payload,
)
print(response)TypeScript SDK (@respan/respan-api)
import { RespanClient } from "@respan/respan-api";
const apiKey = process.env.RESPAN_API_KEY!;
const client = new RespanClient({
respanApiKey: apiKey,
authorization: `Bearer ${apiKey}`,
});
const response = await client.gateway.createResponse({
"X-Respan-Route-Provider": "azure",
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"input": "Summarize the benefits of retrieval-augmented generation.",
"stream": false,
"respan_params": {
"credential_override": {
"azure/YOUR_AZURE_DEPLOYMENT": {
"api_key": "PROVIDER_API_KEY",
"api_base": "https://YOUR_RESOURCE.openai.azure.com",
"api_version": "2025-04-01-preview"
}
}
}
});
console.log(response);perplexity
Headers
{
"X-Respan-Route-Provider": "perplexity",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
}Request
{
"model": "perplexity/sonar",
"input": "Reply with exactly ok.",
"max_steps": 1,
"max_output_tokens": 32,
"stream": false
}Response
{
"body": {
"id": "resp_perplexity_example",
"model": "perplexity/sonar",
"output": []
}
}cURL
curl --request POST 'https://api.respan.ai/api/responses' \
--header "Authorization: Bearer $RESPAN_API_KEY" \
--header 'X-Respan-Route-Provider: perplexity' \
--header 'Content-Type: application/json' \
--data @- <<'JSON'
{
"model": "perplexity/sonar",
"input": "Reply with exactly ok.",
"max_steps": 1,
"max_output_tokens": 32,
"stream": false
}
JSONPython
import json
import os
import urllib.request
payload = json.loads(r'''{
"model": "perplexity/sonar",
"input": "Reply with exactly ok.",
"max_steps": 1,
"max_output_tokens": 32,
"stream": false
}''')
request = urllib.request.Request(
"https://api.respan.ai/api/responses",
data=json.dumps(payload).encode(),
headers={
"Authorization": f"Bearer {os.environ['RESPAN_API_KEY']}",
"Content-Type": "application/json",
"X-Respan-Route-Provider": "perplexity",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.load(response))TypeScript
const response = await fetch("https://api.respan.ai/api/responses", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPAN_API_KEY}`,
"Content-Type": "application/json",
"X-Respan-Route-Provider": "perplexity",
},
body: JSON.stringify({
"model": "perplexity/sonar",
"input": "Reply with exactly ok.",
"max_steps": 1,
"max_output_tokens": 32,
"stream": false
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());Python SDK (respan-api)
import json
import os
from respan import RespanClient
client = RespanClient(respan_api_key=os.environ["RESPAN_API_KEY"])
payload = json.loads(r'''{
"model": "perplexity/sonar",
"input": "Reply with exactly ok.",
"max_steps": 1,
"max_output_tokens": 32,
"stream": false
}''')
response = client.gateway.create_response(
respan_route_provider="perplexity",
**payload,
)
print(response)TypeScript SDK (@respan/respan-api)
import { RespanClient } from "@respan/respan-api";
const apiKey = process.env.RESPAN_API_KEY!;
const client = new RespanClient({
respanApiKey: apiKey,
authorization: `Bearer ${apiKey}`,
});
const response = await client.gateway.createResponse({
"X-Respan-Route-Provider": "perplexity",
"model": "perplexity/sonar",
"input": "Reply with exactly ok.",
"max_steps": 1,
"max_output_tokens": 32,
"stream": false
});
console.log(response);bedrock
Requires your own AWS Bedrock credentials configured in Respan (BYOK). Respan credits are not supported.
Headers
{
"X-Respan-Route-Provider": "bedrock",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
}Request
{
"model": "bedrock/us.openai.gpt-6.1-sol",
"input": "Hello"
}cURL
curl --request POST 'https://api.respan.ai/api/responses' \
--header "Authorization: Bearer $RESPAN_API_KEY" \
--header 'X-Respan-Route-Provider: bedrock' \
--header 'Content-Type: application/json' \
--data @- <<'JSON'
{
"model": "bedrock/us.openai.gpt-6.1-sol",
"input": "Hello"
}
JSONPython
import json
import os
import urllib.request
payload = json.loads(r'''{
"model": "bedrock/us.openai.gpt-6.1-sol",
"input": "Hello"
}''')
request = urllib.request.Request(
"https://api.respan.ai/api/responses",
data=json.dumps(payload).encode(),
headers={
"Authorization": f"Bearer {os.environ['RESPAN_API_KEY']}",
"Content-Type": "application/json",
"X-Respan-Route-Provider": "bedrock",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.load(response))TypeScript
const response = await fetch("https://api.respan.ai/api/responses", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.RESPAN_API_KEY}`,
"Content-Type": "application/json",
"X-Respan-Route-Provider": "bedrock",
},
body: JSON.stringify({
"model": "bedrock/us.openai.gpt-6.1-sol",
"input": "Hello"
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());Python SDK (respan-api)
import json
import os
from respan import RespanClient
client = RespanClient(respan_api_key=os.environ["RESPAN_API_KEY"])
payload = json.loads(r'''{
"model": "bedrock/us.openai.gpt-6.1-sol",
"input": "Hello"
}''')
response = client.gateway.create_response(
respan_route_provider="bedrock",
**payload,
)
print(response)TypeScript SDK (@respan/respan-api)
import { RespanClient } from "@respan/respan-api";
const apiKey = process.env.RESPAN_API_KEY!;
const client = new RespanClient({
respanApiKey: apiKey,
authorization: `Bearer ${apiKey}`,
});
const response = await client.gateway.createResponse({
"X-Respan-Route-Provider": "bedrock",
"model": "bedrock/us.openai.gpt-6.1-sol",
"input": "Hello"
});
console.log(response);Responses
200
Response object or event stream from the selected Responses upstream.
Response headers
X-Respan-Log-Id string Optionalapplication/json
$ object BodyOpenAPI response schema
{
"type": "object",
"additionalProperties": true
}400
Invalid request, provider route configuration, or upstream provider request. Include input and a route-appropriate model, or models for Perplexity.
application/json
$ object Body
error object Required in parent
error.message string Required in parenterror.type string Required in parenterror.param any or null Optionalerror.code any or null OptionalOpenAPI response schema
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"message",
"type"
],
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"param": {
"nullable": true
},
"code": {
"nullable": true
}
}
}
}
}401
No usable provider credential, or the provider rejected it. Configure the provider in Settings › Providers, or pass respan_params.credential_override.
application/json
$ object Body
error object Required in parent
error.message string Required in parenterror.type string Required in parenterror.param any or null Optionalerror.code any or null OptionalOpenAPI response schema
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"message",
"type"
],
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"param": {
"nullable": true
},
"code": {
"nullable": true
}
}
}
}
}403
The API key is missing, invalid or expired.
application/json
$ object Body
detail string Required in parentOpenAPI response schema
{
"type": "object",
"required": [
"detail"
],
"properties": {
"detail": {
"type": "string"
}
}
}Example
{
"detail": "Your API key is invalid or expired, please check your API key in the platform settings."
}422
Request validation failed.
application/json
$ object Body
error object Required in parent
error.message string Required in parenterror.type string Required in parenterror.param any or null Optionalerror.code any or null OptionalOpenAPI response schema
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"message",
"type"
],
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"param": {
"nullable": true
},
"code": {
"nullable": true
}
}
}
}
}OpenAPI source
The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.
OpenAPI operation
{
"operationId": "createResponse",
"summary": "Create a response",
"description": "Creates an OpenAI-compatible response through Respan. Choose the OpenAI, Azure, Perplexity, or Bedrock example. The OpenAI and Perplexity examples use Respan-managed routing when the model is available on credits; provider credentials can also be stored in Settings > Providers or supplied in respan_params.credential_override. For Azure, replace YOUR_AZURE_DEPLOYMENT, YOUR_RESOURCE and PROVIDER_API_KEY with your Azure deployment and credentials. Bedrock Responses requires your own AWS Bedrock credentials configured in Respan (BYOK); Respan credits are not supported for this route. Successful responses include X-Respan-Log-Id and are logged with the provider model and cost.",
"x-fern-examples": [
{
"name": "openai",
"headers": {
"X-Respan-Route-Provider": "openai",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
},
"request": {
"model": "gpt-6-luna",
"input": "Reply with exactly ok.",
"max_output_tokens": 32,
"reasoning": {
"effort": "none"
},
"stream": false
},
"response": {
"body": {
"id": "resp_openai_example",
"model": "gpt-6-luna",
"output": []
}
}
},
{
"name": "azure",
"headers": {
"X-Respan-Route-Provider": "azure",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
},
"request": {
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"input": "Summarize the benefits of retrieval-augmented generation.",
"stream": false,
"respan_params": {
"credential_override": {
"azure/YOUR_AZURE_DEPLOYMENT": {
"api_key": "PROVIDER_API_KEY",
"api_base": "https://YOUR_RESOURCE.openai.azure.com",
"api_version": "2025-04-01-preview"
}
}
}
},
"response": {
"body": {
"id": "resp_azure_example",
"model": "azure/YOUR_AZURE_DEPLOYMENT",
"output": []
}
}
},
{
"name": "perplexity",
"headers": {
"X-Respan-Route-Provider": "perplexity",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
},
"request": {
"model": "perplexity/sonar",
"input": "Reply with exactly ok.",
"max_steps": 1,
"max_output_tokens": 32,
"stream": false
},
"response": {
"body": {
"id": "resp_perplexity_example",
"model": "perplexity/sonar",
"output": []
}
}
},
{
"name": "bedrock",
"description": "Requires your own AWS Bedrock credentials configured in Respan (BYOK). Respan credits are not supported.",
"headers": {
"X-Respan-Route-Provider": "bedrock",
"Authorization": "Bearer YOUR_RESPAN_API_KEY"
},
"request": {
"model": "bedrock/us.openai.gpt-6.1-sol",
"input": "Hello"
}
}
],
"parameters": [
{
"in": "header",
"name": "X-Respan-Route-Provider",
"required": false,
"description": "Responses upstream. Each named API Explorer example prepopulates its matching value; keep the header paired with the selected example. Perplexity and Bedrock routing is header-only, case-insensitive, and whitespace-tolerant.",
"schema": {
"type": "string",
"enum": [
"openai",
"azure",
"perplexity",
"bedrock"
]
}
},
{
"in": "query",
"name": "format",
"schema": {
"type": "string",
"enum": [
"json",
"txt"
]
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "OpenAI Responses API request. Standard Responses fields are accepted. Perplexity extensions are accepted only when X-Respan-Route-Provider is perplexity. Respan cache controls and `customer_identifier` may be sent at the request root or under `respan_params`; nested values win when both are present.",
"additionalProperties": true,
"properties": {
"model": {
"type": "string",
"description": "OpenAI: use a supported model such as gpt-6-luna. Azure: use azure/<your-deployment-name>. Perplexity: use a provider-prefixed model, such as perplexity/sonar, or send `models` instead. Bedrock: use a bedrock-prefixed inference profile, such as bedrock/us.openai.gpt-6.1-sol."
},
"input": {
"description": "Text or structured input for the response.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {}
}
]
},
"stream": {
"type": "boolean",
"default": false,
"description": "Return Responses API server-sent events when true."
},
"preset": {
"type": "string",
"description": "Perplexity Agent API preset, such as `medium`. Send it with `model` or `models`: a preset alone fails Respan's model validation."
},
"models": {
"type": "array",
"description": "Perplexity Agent API fallback model chain, tried in order.",
"items": {
"type": "string"
}
},
"max_steps": {
"type": "integer",
"minimum": 1,
"description": "Maximum Perplexity agent steps."
},
"language_preference": {
"type": "string",
"description": "Preferred response language for Perplexity Agent API."
},
"response_format": {
"type": "object",
"description": "Perplexity Agent API structured response configuration."
},
"skills": {
"type": "array",
"description": "Perplexity Agent API skills.",
"items": {}
},
"tools": {
"type": "array",
"description": "Response tools. Perplexity supports web_search with filters such as search_domain_filter.",
"items": {}
},
"respan_params": {
"type": "object",
"description": "Respan metadata, prompt configuration, customer identifiers, provider credentials, and other gateway parameters. route_provider_override here cannot activate the Perplexity route.",
"properties": {
"credential_override": {
"type": "object",
"description": "Request-scoped provider credentials. Named examples prefill the correct selector; keep that selector and replace only its credential values. OpenAI and Azure selectors exactly match model. Perplexity uses an empty-string selector because its credential is provider-scoped.",
"additionalProperties": {
"type": "object",
"additionalProperties": true,
"properties": {
"api_key": {
"type": "string",
"format": "password",
"writeOnly": true,
"description": "API key for the selected upstream provider, not your Respan API key. Enter the Respan key in the Authorization control."
},
"api_base": {
"type": "string",
"format": "uri",
"description": "Azure OpenAI resource endpoint, for example https://YOUR_RESOURCE.openai.azure.com."
},
"api_version": {
"type": "string",
"description": "Azure OpenAI API version. The Azure example prefills 2025-04-01-preview, which supports the Responses API."
}
}
}
},
"cache_enabled": {
"type": "boolean",
"description": "Enable response caching for this request."
},
"cache_ttl": {
"type": "number",
"description": "Cache lifetime in seconds. A response stored without `cache_ttl` is served from the cache for at most 30 minutes."
},
"cache_options": {
"type": "object",
"properties": {
"cache_by_customer": {
"type": "boolean"
},
"is_cached_by_model": {
"type": "boolean"
},
"omit_log": {
"type": "boolean"
}
},
"additionalProperties": false
},
"customer_identifier": {
"type": "string",
"description": "End-customer identifier used for logging and optional cache partitioning."
}
}
},
"cache_enabled": {
"type": "boolean",
"description": "Enable response caching for this request."
},
"cache_ttl": {
"type": "number",
"description": "Cache lifetime in seconds. A response stored without `cache_ttl` is served from the cache for at most 30 minutes."
},
"cache_options": {
"type": "object",
"properties": {
"cache_by_customer": {
"type": "boolean"
},
"is_cached_by_model": {
"type": "boolean"
},
"omit_log": {
"type": "boolean"
}
},
"additionalProperties": false
},
"customer_identifier": {
"type": "string",
"description": "End-customer identifier used for logging and optional cache partitioning."
}
},
"required": [
"input"
]
}
}
}
},
"tags": [
"Gateway"
],
"security": [
{
"RespanApiKey": []
}
],
"responses": {
"200": {
"description": "Response object or event stream from the selected Responses upstream.",
"headers": {
"X-Respan-Log-Id": {
"description": "Unique ID of the Respan request log.",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
},
"400": {
"description": "Invalid request, provider route configuration, or upstream provider request. Include `input` and a route-appropriate `model`, or `models` for Perplexity.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"message",
"type"
],
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"param": {
"nullable": true
},
"code": {
"nullable": true
}
}
}
}
}
}
}
},
"401": {
"description": "No usable provider credential, or the provider rejected it. Configure the provider in Settings › Providers, or pass `respan_params.credential_override`.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"message",
"type"
],
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"param": {
"nullable": true
},
"code": {
"nullable": true
}
}
}
}
}
}
}
},
"403": {
"$ref": "#/components/responses/InvalidApiKey"
},
"422": {
"description": "Request validation failed.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"message",
"type"
],
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"param": {
"nullable": true
},
"code": {
"nullable": true
}
}
}
}
}
}
}
}
}
}OpenAPI path metadata
{}Referenced OpenAPI components
{
"responses": {
"InvalidApiKey": {
"description": "The API key is missing, invalid or expired.",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"detail"
],
"properties": {
"detail": {
"type": "string"
}
}
},
"example": {
"detail": "Your API key is invalid or expired, please check your API key in the platform settings."
}
}
}
}
},
"securitySchemes": {
"RespanApiKey": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "Respan API key",
"description": "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, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
"x-fern-bearer": {
"name": "respanApiKey",
"env": "RESPAN_API_KEY"
}
}
}
}