OpenAI Responses
Call the Responses API through Runtoken.
Prerequisites#
Before you start, prepare:
- A platform API key created in the console.
- The exact ID of a model supporting OpenAI Responses.
- A server-side HTTP environment; the examples use curl.
Endpoint and authentication#
Send JSON with Authorization: Bearer YOUR_PLATFORM_KEY to the following endpoint.
/v1/responsesThe OpenAI SDK base URL is https://api.runtoken.net/v1.
Send a request#
The example submits a text input and requests streamed output.
curl -N 'https://api.runtoken.net/v1/responses' \
-H 'Authorization: Bearer YOUR_PLATFORM_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "YOUR_MODEL_ID",
"input": "Hello!",
"stream": true
}'Replace these placeholders before running the example.
| Placeholder | Replace with |
|---|---|
YOUR_PLATFORM_KEY | Your platform API key from the console. |
YOUR_MODEL_ID | A model ID that supports Responses. |
curl -N disables output buffering so you can see streamed data as it arrives.
Manage conversation context#
Keep the context your application needs and send it with each request. Do not rely on a response ID to recover a previous turn.
Compact context#
The separate Compact endpoint accepts a request with an input array.
curl 'https://api.runtoken.net/v1/responses/compact' \
-H 'Authorization: Bearer YOUR_PLATFORM_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "YOUR_MODEL_ID",
"input": [{ "role": "user", "content": "Hello!" }]
}'Replace these placeholders before running the example.
| Placeholder | Replace with |
|---|---|
YOUR_PLATFORM_KEY | Your platform API key from the console. |
YOUR_MODEL_ID | A model ID confirmed to support Compact. |
Use this request only with a model that supports Compact; Responses support alone does not establish Compact support.
Parameters and streaming#
Tools, structured output and multimodal input require model-specific confirmation before you add them to a request.
Channel switching stops once output begins. If the stream is interrupted, keep the partial result and handle any retry as a new request; billing may need review.
Next steps#
See OpenAI Chat for the message-based endpoint, or the integration guide for common routing and billing rules.