Containers API
This page documents the 18 gateway endpoints tagged containers 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.
| Method | Path | Summary |
|---|---|---|
| GET | /containers | List code interpreter containers |
| POST | /containers | Create a code interpreter container |
| GET | /v1/containers | List code interpreter containers |
| POST | /v1/containers | Create a code interpreter container |
| GET | /containers/{container_id} | Get a code interpreter container |
| DELETE | /containers/{container_id} | Delete a code interpreter container |
| GET | /v1/containers/{container_id} | Get a code interpreter container |
| DELETE | /v1/containers/{container_id} | Delete a code interpreter container |
| GET | /v1/containers/{container_id}/files | List the files in a container |
| POST | /v1/containers/{container_id}/files | Upload a file to a container |
| GET | /containers/{container_id}/files | List the files in a container |
| POST | /containers/{container_id}/files | Upload a file to a container |
| GET | /v1/containers/{container_id}/files/{file_id} | Get a container file |
| DELETE | /v1/containers/{container_id}/files/{file_id} | Delete a container file |
| GET | /containers/{container_id}/files/{file_id} | Get a container file |
| DELETE | /containers/{container_id}/files/{file_id} | Delete a container file |
| GET | /v1/containers/{container_id}/files/{file_id}/content | Download a container file |
| GET | /containers/{container_id}/files/{file_id}/content | Download a container file |
Endpoints
GET /containers
List code interpreter containers
Lists the code interpreter containers at the provider, one page at a time, in the shape of the OpenAI Containers API. Proxy admins see every container, any other key sees only the containers it created through this gateway. It changes nothing.
Page with limit and after (the last_id of the previous page) and sort with order (asc or desc).
The provider defaults to openai and is picked with the custom-llm-provider header or query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
after | query | string or null | No | |
limit | query | integer or null | No | |
order | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/containers" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of containers the caller may see. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | Yes | Object |
data | array of object | Yes | Data |
first_id | string or null | No | First Id |
last_id | string or null | No | Last Id |
has_more | boolean | Yes | Has More |
POST /containers
Create a code interpreter container
Creates a sandbox at the provider where a model can run code, upload files and keep them between calls, in the shape of the OpenAI Containers API. Any key that may use the provider can call it. The gateway records the key, user and team that created the container, so later calls from other callers cannot read or delete it.
The provider defaults to openai. Pick another one with the custom-llm-provider header, the
custom_llm_provider query parameter or the same field in the body. expires_after sets how many idle
minutes the container lives.
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
expires_after | object or null | No | Expires After |
file_ids | array of string or null | No | File Ids |
extra_headers | object or null | No | Extra Headers |
extra_body | object or null | No | Extra Body |
name | string | No | Name |
Example request:
curl -X POST "http://localhost:4000/containers" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "analysis-session",
"expires_after": {
"anchor": "last_active_at",
"minutes": 20
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container object. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | "container" | Yes | Object |
created_at | integer | Yes | Created At |
status | string | Yes | Status |
expires_after | object or null | No | |
last_active_at | integer or null | No | Last Active At |
name | string or null | No | Name |
GET /v1/containers
List code interpreter containers
Lists the code interpreter containers at the provider, one page at a time, in the shape of the OpenAI Containers API. Proxy admins see every container, any other key sees only the containers it created through this gateway. It changes nothing.
Page with limit and after (the last_id of the previous page) and sort with order (asc or desc).
The provider defaults to openai and is picked with the custom-llm-provider header or query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
after | query | string or null | No | |
limit | query | integer or null | No | |
order | query | string or null | No |
Example request:
curl -X GET "http://localhost:4000/v1/containers" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One page of containers the caller may see. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | Yes | Object |
data | array of object | Yes | Data |
first_id | string or null | No | First Id |
last_id | string or null | No | Last Id |
has_more | boolean | Yes | Has More |
POST /v1/containers
Create a code interpreter container
Creates a sandbox at the provider where a model can run code, upload files and keep them between calls, in the shape of the OpenAI Containers API. Any key that may use the provider can call it. The gateway records the key, user and team that created the container, so later calls from other callers cannot read or delete it.
The provider defaults to openai. Pick another one with the custom-llm-provider header, the
custom_llm_provider query parameter or the same field in the body. expires_after sets how many idle
minutes the container lives.
Request body (application/json, object):
| Field | Type | Required | Description |
|---|---|---|---|
expires_after | object or null | No | Expires After |
file_ids | array of string or null | No | File Ids |
extra_headers | object or null | No | Extra Headers |
extra_body | object or null | No | Extra Body |
name | string | No | Name |
Example request:
curl -X POST "http://localhost:4000/v1/containers" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "analysis-session",
"expires_after": {
"anchor": "last_active_at",
"minutes": 20
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container object. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | "container" | Yes | Object |
created_at | integer | Yes | Created At |
status | string | Yes | Status |
expires_after | object or null | No | |
last_active_at | integer or null | No | Last Active At |
name | string or null | No | Name |
GET /containers/{container_id}
Get a code interpreter container
Shows one code interpreter container, with its status and when it expires. The caller must be the key, user or team that created it, or a proxy admin, otherwise the answer is 403. It changes nothing.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/containers/container_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container object. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | "container" | Yes | Object |
created_at | integer | Yes | Created At |
status | string | Yes | Status |
expires_after | object or null | No | |
last_active_at | integer or null | No | Last Active At |
name | string or null | No | Name |
DELETE /containers/{container_id}
Delete a code interpreter container
Deletes a code interpreter container and the files in it at the provider, for good. The caller must be the key, user or team that created it, or a proxy admin, otherwise the answer is 403.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/containers/container_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container was deleted at the provider. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | "container.deleted" | Yes | Object |
deleted | boolean | Yes | Deleted |
GET /v1/containers/{container_id}
Get a code interpreter container
Shows one code interpreter container, with its status and when it expires. The caller must be the key, user or team that created it, or a proxy admin, otherwise the answer is 403. It changes nothing.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/containers/container_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container object. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | "container" | Yes | Object |
created_at | integer | Yes | Created At |
status | string | Yes | Status |
expires_after | object or null | No | |
last_active_at | integer or null | No | Last Active At |
name | string or null | No | Name |
DELETE /v1/containers/{container_id}
Delete a code interpreter container
Deletes a code interpreter container and the files in it at the provider, for good. The caller must be the key, user or team that created it, or a proxy admin, otherwise the answer is 403.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/v1/containers/container_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container was deleted at the provider. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | "container.deleted" | Yes | Object |
deleted | boolean | Yes | Deleted |
GET /v1/containers/{container_id}/files
List the files in a container
List the files inside a code interpreter container, both the files you uploaded and the files the model's code wrote. after, limit and order page the list. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
after | query | string | No | Return the files after this file id, taken from last_id of the previous page. |
limit | query | integer | No | How many files to return per page, from 1 to 100. The provider's default is 20. |
order | query | enum: "asc", "desc" | No | Sort by creation time, asc for oldest first or desc for newest first. |
Example request:
curl -X GET "http://localhost:4000/v1/containers/container_id-123/files" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The files in the container. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | Yes | Object |
data | array of object | Yes | Data |
first_id | string or null | No | First Id |
last_id | string or null | No | Last Id |
has_more | boolean | Yes | Has More |
POST /v1/containers/{container_id}/files
Upload a file to a container
Add a file to a code interpreter container as multipart form data with a file field. The file appears under /mnt/data for the model's code. An upload larger than general_settings.max_file_size_mb is refused with 413 before it reaches the provider. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes |
Request body (multipart/form-data, object):
| Field | Type | Required | Description |
|---|---|---|---|
file | string | Yes | The file to add to the container. |
Example request:
curl -X POST "http://localhost:4000/v1/containers/container_id-123/files" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-F file="@file.bin"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container file. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | enum: "container.file", "container_file" | Yes | Object |
container_id | string | Yes | Container Id |
bytes | integer or null | No | Bytes |
created_at | integer | Yes | Created At |
path | string | Yes | Path |
source | string | Yes | Source |
GET /containers/{container_id}/files
List the files in a container
List the files inside a code interpreter container, both the files you uploaded and the files the model's code wrote. after, limit and order page the list. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
after | query | string | No | Return the files after this file id, taken from last_id of the previous page. |
limit | query | integer | No | How many files to return per page, from 1 to 100. The provider's default is 20. |
order | query | enum: "asc", "desc" | No | Sort by creation time, asc for oldest first or desc for newest first. |
Example request:
curl -X GET "http://localhost:4000/containers/container_id-123/files" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The files in the container. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
object | "list" | Yes | Object |
data | array of object | Yes | Data |
first_id | string or null | No | First Id |
last_id | string or null | No | Last Id |
has_more | boolean | Yes | Has More |
POST /containers/{container_id}/files
Upload a file to a container
Add a file to a code interpreter container as multipart form data with a file field. The file appears under /mnt/data for the model's code. An upload larger than general_settings.max_file_size_mb is refused with 413 before it reaches the provider. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes |
Request body (multipart/form-data, object):
| Field | Type | Required | Description |
|---|---|---|---|
file | string | Yes | The file to add to the container. |
Example request:
curl -X POST "http://localhost:4000/containers/container_id-123/files" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-F file="@file.bin"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container file. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | enum: "container.file", "container_file" | Yes | Object |
container_id | string | Yes | Container Id |
bytes | integer or null | No | Bytes |
created_at | integer | Yes | Created At |
path | string | Yes | Path |
source | string | Yes | Source |
GET /v1/containers/{container_id}/files/{file_id}
Get a container file
Return the metadata of one container file, including its path inside the container and whether the user or the assistant created it. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
file_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/containers/container_id-123/files/file_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container file. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | enum: "container.file", "container_file" | Yes | Object |
container_id | string | Yes | Container Id |
bytes | integer or null | No | Bytes |
created_at | integer | Yes | Created At |
path | string | Yes | Path |
source | string | Yes | Source |
DELETE /v1/containers/{container_id}/files/{file_id}
Delete a container file
Remove a file from the container. Files the model's code wrote can be deleted the same way. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
file_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/v1/containers/container_id-123/files/file_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Confirmation that the file was removed. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | enum: "container.file.deleted", "container_file.deleted" | Yes | Object |
deleted | boolean | Yes | Deleted |
GET /containers/{container_id}/files/{file_id}
Get a container file
Return the metadata of one container file, including its path inside the container and whether the user or the assistant created it. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
file_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/containers/container_id-123/files/file_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The container file. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | enum: "container.file", "container_file" | Yes | Object |
container_id | string | Yes | Container Id |
bytes | integer or null | No | Bytes |
created_at | integer | Yes | Created At |
path | string | Yes | Path |
source | string | Yes | Source |
DELETE /containers/{container_id}/files/{file_id}
Delete a container file
Remove a file from the container. Files the model's code wrote can be deleted the same way. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
file_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/containers/container_id-123/files/file_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Confirmation that the file was removed. | application/json object |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Id |
object | enum: "container.file.deleted", "container_file.deleted" | Yes | Object |
deleted | boolean | Yes | Deleted |
GET /v1/containers/{container_id}/files/{file_id}/content
Download a container file
Return the bytes of a container file, for example a chart or spreadsheet the model's code produced. The answer is always application/octet-stream, so use the file's path from the metadata route to tell its type. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
file_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/containers/container_id-123/files/file_id-123/content" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The file bytes, always sent as application/octet-stream whatever the file holds. | application/octet-stream string |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |
GET /containers/{container_id}/files/{file_id}/content
Download a container file
Return the bytes of a container file, for example a chart or spreadsheet the model's code produced. The answer is always application/octet-stream, so use the file's path from the metadata route to tell its type. Any valid key may call it for a container created by the same user, team, organization or key, and a proxy admin for any container, anyone else gets 403. When the container is not on OpenAI, name its provider in the custom-llm-provider header or the custom_llm_provider query parameter.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
container_id | path | string | Yes | |
file_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/containers/container_id-123/files/file_id-123/content" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The file bytes, always sent as application/octet-stream whatever the file holds. | application/octet-stream string |
| 400 | The 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 |
| 401 | No valid key was sent, or the key has expired or is blocked. | application/json ProxyError |
| 403 | The key is valid but may not use this model, route or feature. A guardrail block is a 400, not a 403. | application/json ProxyError |
| 404 | The 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 |
| 408 | The provider did not answer before the request timed out. | application/json ProxyError |
| 413 | The 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. Docs | application/json object |
| 422 | The 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 error | application/json ProxyError or HTTPValidationError |
| 429 | Too 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 error | application/json ProxyError |
| 500 | The 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 |
| 502 | The provider, or a proxy in front of it, answered with something that is not a valid response. | application/json ProxyError |
| 503 | The 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. Docs | application/json ProxyError |