Skip to main content

Assistants API

This page documents the 16 gateway endpoints tagged assistants in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.

MethodPathSummary
GET/assistantsList assistants
POST/assistantsCreate an assistant
GET/v1/assistantsList assistants
POST/v1/assistantsCreate an assistant
DELETE/assistants/{assistant_id}Delete an assistant
DELETE/v1/assistants/{assistant_id}Delete an assistant
POST/threadsCreate a thread
POST/v1/threadsCreate a thread
GET/threads/{thread_id}Get a thread
GET/v1/threads/{thread_id}Get a thread
GET/threads/{thread_id}/messagesList the messages of a thread
POST/threads/{thread_id}/messagesAdd a message to a thread
GET/v1/threads/{thread_id}/messagesList the messages of a thread
POST/v1/threads/{thread_id}/messagesAdd a message to a thread
POST/threads/{thread_id}/runsRun an assistant on a thread
POST/v1/threads/{thread_id}/runsRun an assistant on a thread

Endpoints​

GET /assistants​

List assistants

List the assistants stored with the provider. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Example request:

curl -X GET "http://localhost:4000/assistants" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of assistants, in the OpenAI list shape.application/json SyncCursorPage_Assistant_
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
dataarray of AssistantYesData
has_moreboolean or nullNoHas More

POST /assistants​

Create an assistant

Create an assistant, a saved set of instructions, model and tools that runs on threads. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Request body (application/json, object):

FieldTypeRequiredDescription
modelstringYesModel
namestring or nullNoName
descriptionstring or nullNoDescription
instructionsstring or nullNoInstructions
toolsarray of object or nullNoTools
metadataobject or nullNoMetadata

Example request:

curl -X POST "http://localhost:4000/assistants" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"name": "Support helper",
"instructions": "Answer support questions briefly.",
"tools": [
{
"type": "file_search"
}
]
}'

Responses:

StatusDescriptionBody
200The assistant object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
descriptionstring or nullNoDescription
instructionsstring or nullNoInstructions
metadataobject or nullNoMetadata
modelstringYesModel
namestring or nullNoName
object"assistant"YesObject
toolsarray of objectYesTools
response_format"auto" or object or nullNoResponse Format
temperaturenumber or nullNoTemperature
tool_resourcesobject or nullNo
top_pnumber or nullNoTop P

GET /v1/assistants​

List assistants

List the assistants stored with the provider. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Example request:

curl -X GET "http://localhost:4000/v1/assistants" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of assistants, in the OpenAI list shape.application/json SyncCursorPage_Assistant_
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
dataarray of AssistantYesData
has_moreboolean or nullNoHas More

POST /v1/assistants​

Create an assistant

Create an assistant, a saved set of instructions, model and tools that runs on threads. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Request body (application/json, object):

FieldTypeRequiredDescription
modelstringYesModel
namestring or nullNoName
descriptionstring or nullNoDescription
instructionsstring or nullNoInstructions
toolsarray of object or nullNoTools
metadataobject or nullNoMetadata

Example request:

curl -X POST "http://localhost:4000/v1/assistants" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"name": "Support helper",
"instructions": "Answer support questions briefly.",
"tools": [
{
"type": "file_search"
}
]
}'

Responses:

StatusDescriptionBody
200The assistant object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
descriptionstring or nullNoDescription
instructionsstring or nullNoInstructions
metadataobject or nullNoMetadata
modelstringYesModel
namestring or nullNoName
object"assistant"YesObject
toolsarray of objectYesTools
response_format"auto" or object or nullNoResponse Format
temperaturenumber or nullNoTemperature
tool_resourcesobject or nullNo
top_pnumber or nullNoTop P

DELETE /assistants/{assistant_id}​

Delete an assistant

Delete an assistant at the provider. Threads keep their messages, but no new run can use it. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
assistant_idpathstringYes

Example request:

curl -X DELETE "http://localhost:4000/assistants/assistant_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The id of the deleted assistant.application/json AssistantDeleted
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
deletedbooleanYesDeleted
object"assistant.deleted"YesObject

DELETE /v1/assistants/{assistant_id}​

Delete an assistant

Delete an assistant at the provider. Threads keep their messages, but no new run can use it. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
assistant_idpathstringYes

Example request:

curl -X DELETE "http://localhost:4000/v1/assistants/assistant_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The id of the deleted assistant.application/json AssistantDeleted
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
deletedbooleanYesDeleted
object"assistant.deleted"YesObject

POST /threads​

Create a thread

Start a thread, the conversation an assistant works on, optionally with its first messages. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Request body (application/json, object):

FieldTypeRequiredDescription
messagesarray of object or nullNoMessages
metadataobject or nullNoMetadata

Example request:

curl -X POST "http://localhost:4000/threads" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "How do I reset my password?"
}
]
}'

Responses:

StatusDescriptionBody
200The thread object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
metadataany or nullNoMetadata
object"thread"YesObject

POST /v1/threads​

Create a thread

Start a thread, the conversation an assistant works on, optionally with its first messages. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Request body (application/json, object):

FieldTypeRequiredDescription
messagesarray of object or nullNoMessages
metadataobject or nullNoMetadata

Example request:

curl -X POST "http://localhost:4000/v1/threads" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "How do I reset my password?"
}
]
}'

Responses:

StatusDescriptionBody
200The thread object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
metadataany or nullNoMetadata
object"thread"YesObject

GET /threads/{thread_id}​

Get a thread

Read one thread by its id. Nothing changes. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/threads/thread_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The thread object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
metadataany or nullNoMetadata
object"thread"YesObject

GET /v1/threads/{thread_id}​

Get a thread

Read one thread by its id. Nothing changes. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/v1/threads/thread_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The thread object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
created_atintegerYesCreated At
metadataany or nullNoMetadata
object"thread"YesObject

GET /threads/{thread_id}/messages​

List the messages of a thread

List the messages of a thread, newest first, including the assistant's replies. Nothing changes. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/threads/thread_id-123/messages" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of the thread's messages, in the OpenAI list shape.application/json SyncCursorPage_Message_
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
dataarray of Message-OutputYesData
has_moreboolean or nullNoHas More

POST /threads/{thread_id}/messages​

Add a message to a thread

Add a message to a thread before running an assistant on it. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Request body (application/json, object):

FieldTypeRequiredDescription
roleenum: "user", "assistant"YesRole
contentstring or array of objectYesContent
attachmentsarray of object or nullNoAttachments
metadataobject or nullNoMetadata

Example request:

curl -X POST "http://localhost:4000/threads/thread_id-123/messages" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "user",
"content": "How do I reset my password?"
}'

Responses:

StatusDescriptionBody
200The message object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
assistant_idstring or nullNoAssistant Id
attachmentsarray of object or nullNoAttachments
completed_atinteger or nullNoCompleted At
contentarray of objectYesContent
created_atintegerYesCreated At
incomplete_atinteger or nullNoIncomplete At
incomplete_detailsobject or nullNo
metadataobject or nullNoMetadata
object"thread.message"YesObject
roleenum: "user", "assistant"YesRole
run_idstring or nullNoRun Id
statusenum: "in_progress", "incomplete", "completed"YesStatus
thread_idstringYesThread Id

GET /v1/threads/{thread_id}/messages​

List the messages of a thread

List the messages of a thread, newest first, including the assistant's replies. Nothing changes. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Example request:

curl -X GET "http://localhost:4000/v1/threads/thread_id-123/messages" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200One page of the thread's messages, in the OpenAI list shape.application/json SyncCursorPage_Message_
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
dataarray of Message-OutputYesData
has_moreboolean or nullNoHas More

POST /v1/threads/{thread_id}/messages​

Add a message to a thread

Add a message to a thread before running an assistant on it. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Request body (application/json, object):

FieldTypeRequiredDescription
roleenum: "user", "assistant"YesRole
contentstring or array of objectYesContent
attachmentsarray of object or nullNoAttachments
metadataobject or nullNoMetadata

Example request:

curl -X POST "http://localhost:4000/v1/threads/thread_id-123/messages" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "user",
"content": "How do I reset my password?"
}'

Responses:

StatusDescriptionBody
200The message object.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
assistant_idstring or nullNoAssistant Id
attachmentsarray of object or nullNoAttachments
completed_atinteger or nullNoCompleted At
contentarray of objectYesContent
created_atintegerYesCreated At
incomplete_atinteger or nullNoIncomplete At
incomplete_detailsobject or nullNo
metadataobject or nullNoMetadata
object"thread.message"YesObject
roleenum: "user", "assistant"YesRole
run_idstring or nullNoRun Id
statusenum: "in_progress", "incomplete", "completed"YesStatus
thread_idstringYesThread Id

POST /threads/{thread_id}/runs​

Run an assistant on a thread

Start a run, which has an assistant read the thread and add its reply. Without stream the call waits until the run finishes and returns it, with stream set to true the events arrive as they happen. Then list the thread's messages to read the reply. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Request body (application/json, object):

FieldTypeRequiredDescription
assistant_idstringYesAssistant Id
modelstring or nullNoModel
instructionsstring or nullNoInstructions
additional_instructionsstring or nullNoAdditional Instructions
toolsarray of object or nullNoTools
metadataobject or nullNoMetadata
streamboolean or nullNoStream

Example request:

curl -X POST "http://localhost:4000/threads/thread_id-123/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assistant_id": "asst_7c2d4e1f"
}'

Responses:

StatusDescriptionBody
200The run object. Poll it until status is completed, then read the thread's messages.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
assistant_idstringYesAssistant Id
cancelled_atinteger or nullNoCancelled At
completed_atinteger or nullNoCompleted At
created_atintegerYesCreated At
expires_atinteger or nullNoExpires At
failed_atinteger or nullNoFailed At
incomplete_detailsobject or nullNo
instructionsstringYesInstructions
last_errorobject or nullNo
max_completion_tokensinteger or nullNoMax Completion Tokens
max_prompt_tokensinteger or nullNoMax Prompt Tokens
metadataobject or nullNoMetadata
modelstringYesModel
object"thread.run"YesObject
parallel_tool_callsbooleanYesParallel Tool Calls
required_actionobject or nullNo
response_format"auto" or object or nullNoResponse Format
started_atinteger or nullNoStarted At
statusenum: "queued", "in_progress", "requires_action", "cancelling", "cancelled", "failed", "completed", "incomplete", ...YesStatus
thread_idstringYesThread Id
tool_choiceenum: "none", "auto", "required" or object or nullNoTool Choice
toolsarray of objectYesTools
truncation_strategyobject or nullNo
usageobject or nullNo
temperaturenumber or nullNoTemperature
top_pnumber or nullNoTop P

POST /v1/threads/{thread_id}/runs​

Run an assistant on a thread

Start a run, which has an assistant read the thread and add its reply. Without stream the call waits until the run finishes and returns it, with stream set to true the events arrive as they happen. Then list the thread's messages to read the reply. Assistants, threads, messages and runs are stored by the provider named in assistant_settings of the gateway config, in the OpenAI Assistants format, and the gateway forwards the call with the credentials from that setting, so callers never hold the provider key. Any virtual key allowed to call LLM routes can call it, and the call is logged like any other request.

Parameters:

NameInTypeRequiredDescription
thread_idpathstringYes

Request body (application/json, object):

FieldTypeRequiredDescription
assistant_idstringYesAssistant Id
modelstring or nullNoModel
instructionsstring or nullNoInstructions
additional_instructionsstring or nullNoAdditional Instructions
toolsarray of object or nullNoTools
metadataobject or nullNoMetadata
streamboolean or nullNoStream

Example request:

curl -X POST "http://localhost:4000/v1/threads/thread_id-123/runs" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assistant_id": "asst_7c2d4e1f"
}'

Responses:

StatusDescriptionBody
200The run object. Poll it until status is completed, then read the thread's messages.application/json object
400The request is invalid, for example a missing or unsupported parameter, a prompt longer than the model's context window, content a guardrail or the provider refused, or no deployment that satisfies the data policy of the key, team or organization (No deployment of model 'gpt-5.5' satisfies the data policy: ...). error.message says which.application/json ProxyError
401No valid key was sent, or the key has expired or is blocked.application/json ProxyError
403The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403.application/json ProxyError
404The route or resource does not exist, or this key cannot see it. An unknown model name is a 400 (Invalid model name passed in model=...).application/json ProxyError
408The provider did not answer before the request timed out.application/json ProxyError
413The request body is larger than max_request_size_mb (100 MB by default), or an upload is larger than its own limit. The gateway refused it before reading the key. Docsapplication/json object
422The request body does not have the expected shape, or a budget (key, user, team, organization or end user) is used up: error.type is budget_exceeded. The budget status is spanway_settings.budget_exceeded_status_code, 422 by default. With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError or HTTPValidationError
429Too many requests. A provider limit or a gateway limit (requests or tokens per minute, or parallel requests) refused the call, and error.type says which. A gateway limit also sends the RateLimit headers and x-spanway-rate-limited-by. Docs With access requests licensed, a key or team limit refusal also carries error.request_increase, which names the access request to file for a higher limit. Ask from an errorapplication/json ProxyError
500The gateway or the provider failed unexpectedly, or the gateway could not reach the provider. Retry, and quote the request id if it keeps failing.application/json ProxyError
502The provider, or a proxy in front of it, answered with something that is not a valid response.application/json ProxyError
503The provider is overloaded or unavailable. With Redis rate limiting, a 503 also means the gateway could not check the rate limit counters and refused the request, because fail_closed_rate_limit_enforcement is on. Docsapplication/json ProxyError

Response fields (200):

FieldTypeRequiredDescription
idstringYesId
assistant_idstringYesAssistant Id
cancelled_atinteger or nullNoCancelled At
completed_atinteger or nullNoCompleted At
created_atintegerYesCreated At
expires_atinteger or nullNoExpires At
failed_atinteger or nullNoFailed At
incomplete_detailsobject or nullNo
instructionsstringYesInstructions
last_errorobject or nullNo
max_completion_tokensinteger or nullNoMax Completion Tokens
max_prompt_tokensinteger or nullNoMax Prompt Tokens
metadataobject or nullNoMetadata
modelstringYesModel
object"thread.run"YesObject
parallel_tool_callsbooleanYesParallel Tool Calls
required_actionobject or nullNo
response_format"auto" or object or nullNoResponse Format
started_atinteger or nullNoStarted At
statusenum: "queued", "in_progress", "requires_action", "cancelling", "cancelled", "failed", "completed", "incomplete", ...YesStatus
thread_idstringYesThread Id
tool_choiceenum: "none", "auto", "required" or object or nullNoTool Choice
toolsarray of objectYesTools
truncation_strategyobject or nullNo
usageobject or nullNo
temperaturenumber or nullNoTemperature
top_pnumber or nullNoTop P