Responses API Documentation for Sprelay
Responses provides a unified input and output structure for Codex, modern agents, tools, and multimodal workflows. Confirm that the model and group support this protocol.
This guide covers Sprelay's Responses-compatible endpoint. A model supporting Chat Completions does not automatically support Responses or every optional Responses feature.
| Setting | Value |
|---|---|
| Complete endpoint | https://sprelaytoken.com/v1/responses |
| SDK base URL | https://sprelaytoken.com/v1 |
| Authentication | Bearer token using your Sprelay API key |
| Minimal request fields | model, input |
Before trying the examples, create a dedicated key with a small quota and check the model and group in the live catalog.
curl
# Responses uses /v1/responses and the same Bearer authentication.
curl https://sprelaytoken.com/v1/responses \
-H "Authorization: Bearer $SPRELAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "Reply only: Responses connection successful"
}'model must support Responses, and input is the request content. Preserve the JSON quotes and commas when editing.
Python SDK
# Import the SDK and read the key from the environment.
import os
from openai import OpenAI
# Keep the base URL at /v1; the SDK appends /responses.
client = OpenAI(
api_key=os.environ["SPRELAY_API_KEY"],
base_url="https://sprelaytoken.com/v1",
)
# A plain string is the easiest input for the first test.
response = client.responses.create(
model="gpt-5.6-sol",
input="Give three reasons not to put API keys in frontend code.",
)
# output_text is the SDK's convenient aggregated text field.
print(response.output_text)JavaScript SDK
// Import the SDK; read the key from the Node.js environment.
import OpenAI from 'openai'
const client = new OpenAI({
apiKey: process.env.SPRELAY_API_KEY,
baseURL: 'https://sprelaytoken.com/v1',
})
// The SDK sends this object to POST /v1/responses.
const response = await client.responses.create({
model: 'gpt-5.6-sol',
input: 'Give three reasons not to put API keys in frontend code.',
})
// Print only the aggregated text.
console.log(response.output_text)Chat Completions usually returns choices; Responses returns output, while SDKs commonly expose output_text. Do not reuse a Chat Completions response parser unchanged. A 404 usually means /v1 or /responses was appended twice.
Response parsing and feature support
output can contain several types of items. The SDK's output_text convenience property is useful for a simple text response, but tool calls and other output types need their own handling. If your existing code expects choices[0].message.content, follow Chat Completions instead.
Methods such as client.responses.parse also depend on the SDK version and the selected model's structured-output support. First verify a basic responses.create request. Do not assume that every field in a provider's API is supported by every Sprelay group.
Confirm usage and diagnose errors
Verify the response status and generated content, then match the request in usage logs. Check billing before testing a long agent workflow.
For 401, check the key, expiry and balance. For a model access error, check the model ID, group and protocol. For 404, inspect the actual endpoint path. Other statuses are covered in API error troubleshooting.
When contacting support, share the timestamp, status, model ID and a redacted request ID. Keep the full API key private.
