OpenAI Pass-through API
This page documents the 5 gateway endpoints tagged OpenAI Pass-through 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 | /openai_passthrough/{endpoint} | Forward a native OpenAI request |
| POST | /openai_passthrough/{endpoint} | Forward a native OpenAI request |
| PUT | /openai_passthrough/{endpoint} | Forward a native OpenAI request |
| PATCH | /openai_passthrough/{endpoint} | Forward a native OpenAI request |
| DELETE | /openai_passthrough/{endpoint} | Forward a native OpenAI request |
Endpoints
GET /openai_passthrough/{endpoint}
Forward a native OpenAI request
Send any OpenAI API path, such as /v1/responses or /v1/chat/completions, exactly as OpenAI defines it. /openai_passthrough always reaches OpenAI, while /openai first checks whether the path names a deployment from model_list and routes through it when it does. The caller authenticates with a Spanway virtual key. The gateway swaps in its own provider credential, forwards the request, records the call in the spend logs and returns the provider's response unchanged, including the provider's own error responses and status codes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
endpoint | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X GET "http://localhost:4000/openai_passthrough/endpoint-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"input": "Say hello to the support team."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The provider's own response, returned unchanged. | application/json object |
| 401 | The Spanway virtual key is missing, expired, blocked or over budget. | application/json ProxyError |
| 403 | The key or its team is not allowed to call this pass-through route. | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no provider credential for this route. | application/json ErrorDetail |
POST /openai_passthrough/{endpoint}
Forward a native OpenAI request
Send any OpenAI API path, such as /v1/responses or /v1/chat/completions, exactly as OpenAI defines it. /openai_passthrough always reaches OpenAI, while /openai first checks whether the path names a deployment from model_list and routes through it when it does. The caller authenticates with a Spanway virtual key. The gateway swaps in its own provider credential, forwards the request, records the call in the spend logs and returns the provider's response unchanged, including the provider's own error responses and status codes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
endpoint | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/openai_passthrough/endpoint-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"input": "Say hello to the support team."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The provider's own response, returned unchanged. | application/json object |
| 401 | The Spanway virtual key is missing, expired, blocked or over budget. | application/json ProxyError |
| 403 | The key or its team is not allowed to call this pass-through route. | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no provider credential for this route. | application/json ErrorDetail |
PUT /openai_passthrough/{endpoint}
Forward a native OpenAI request
Send any OpenAI API path, such as /v1/responses or /v1/chat/completions, exactly as OpenAI defines it. /openai_passthrough always reaches OpenAI, while /openai first checks whether the path names a deployment from model_list and routes through it when it does. The caller authenticates with a Spanway virtual key. The gateway swaps in its own provider credential, forwards the request, records the call in the spend logs and returns the provider's response unchanged, including the provider's own error responses and status codes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
endpoint | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X PUT "http://localhost:4000/openai_passthrough/endpoint-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"input": "Say hello to the support team."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The provider's own response, returned unchanged. | application/json object |
| 401 | The Spanway virtual key is missing, expired, blocked or over budget. | application/json ProxyError |
| 403 | The key or its team is not allowed to call this pass-through route. | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no provider credential for this route. | application/json ErrorDetail |
PATCH /openai_passthrough/{endpoint}
Forward a native OpenAI request
Send any OpenAI API path, such as /v1/responses or /v1/chat/completions, exactly as OpenAI defines it. /openai_passthrough always reaches OpenAI, while /openai first checks whether the path names a deployment from model_list and routes through it when it does. The caller authenticates with a Spanway virtual key. The gateway swaps in its own provider credential, forwards the request, records the call in the spend logs and returns the provider's response unchanged, including the provider's own error responses and status codes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
endpoint | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X PATCH "http://localhost:4000/openai_passthrough/endpoint-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"input": "Say hello to the support team."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The provider's own response, returned unchanged. | application/json object |
| 401 | The Spanway virtual key is missing, expired, blocked or over budget. | application/json ProxyError |
| 403 | The key or its team is not allowed to call this pass-through route. | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no provider credential for this route. | application/json ErrorDetail |
DELETE /openai_passthrough/{endpoint}
Forward a native OpenAI request
Send any OpenAI API path, such as /v1/responses or /v1/chat/completions, exactly as OpenAI defines it. /openai_passthrough always reaches OpenAI, while /openai first checks whether the path names a deployment from model_list and routes through it when it does. The caller authenticates with a Spanway virtual key. The gateway swaps in its own provider credential, forwards the request, records the call in the spend logs and returns the provider's response unchanged, including the provider's own error responses and status codes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
endpoint | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X DELETE "http://localhost:4000/openai_passthrough/endpoint-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"input": "Say hello to the support team."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The provider's own response, returned unchanged. | application/json object |
| 401 | The Spanway virtual key is missing, expired, blocked or over budget. | application/json ProxyError |
| 403 | The key or its team is not allowed to call this pass-through route. | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no provider credential for this route. | application/json ErrorDetail |