Responses
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.
curl
bash
# 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
python
# 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
javascript
// 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.
