Responses API (/v1/responses)
/v1/responses is one of the platform's chat endpoints (text in → text out, synchronous request-response, optional streaming) and follows the OpenAI Responses API format — if you are already using the responses interface of the OpenAI SDK (or tools that default to Responses, such as Codex CLI or the OpenAI Agents SDK), just point base_url at the platform address and swap in your platform API key to connect directly.
Relationship with
/v1/chat/completions: the two are coexisting chat entry points with equivalent capabilities and identical billing. No migration is needed if you already use chat; choose this endpoint if your tooling defaults to Responses or you prefer theinput/instructions/reasoningparameter shape. The chat model list is whateverGET /v1/modelsreturns.
1. Quick Start (Non-Streaming)
curl https://token.yaoshu.cc/v1/responses \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"input": "Introduce yourself in one sentence."
}'The response uses the standard Responses format: the answer text is in the output_text content block within output[] (the SDK exposes the aggregated response.output_text property directly), and usage is in usage (input_tokens / output_tokens).
from openai import OpenAI
client = OpenAI(api_key="sk-your-api-key", base_url="https://token.yaoshu.cc/v1")
response = client.responses.create(
model="<model>",
input="Introduce yourself in one sentence.",
)
print(response.output_text)2. Streaming (SSE Named Events)
With stream: true the response is an SSE stream of named events (different from chat's delta chunk shape):
curl https://token.yaoshu.cc/v1/responses \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "<model>",
"input": "Write a short poem about autumn.",
"stream": true
}'Core event sequence:
| Event | Meaning |
|---|---|
response.created | Response started |
response.output_item.added | An output item (answer message / reasoning / tool call) begins |
response.output_text.delta | Answer text delta (the delta field holds a text fragment; concatenate frame by frame) |
response.output_item.done | That output item ends |
response.completed | Response completed; usage is provided with this event |
Reasoning models emit reasoning-related events according to their capabilities (before response.output_text.delta), and tool calls appear as function_call output items — the event structure is identical to the official OpenAI Responses API, so consume it with the official SDK's event handling.
with client.responses.stream(
model="<model>",
input="Write a short poem about autumn.",
) as stream:
for text in stream.text_stream:
print(text, end="")3. Parameter Overview (Mapping from Chat)
When migrating from /v1/chat/completions, rewrite the parameters as follows (other sampling parameters such as temperature / top_p pass through under the same name):
| Responses parameter | Chat equivalent | Description |
|---|---|---|
input | messages | A string, or an array of message items (role + content); semantics match messages |
instructions | system message | A separate top-level field, placed before the conversation as system-level instructions |
max_output_tokens | max_tokens | Output limit |
reasoning.effort | reasoning_effort | Reasoning level: low / medium / high (only effective on reasoning models) |
tools | tools | Tools are declared in a flat shape (type: "function", with no nested function layer) |
stream | stream | Streaming switch (event shape in the previous section) |
Conversation context: a stateless model, same as chat — each request carries the full conversation context (pass prior messages in the input array); there is no server-side conversation continuation.
4. Billing
Billing follows the same rules as the chat endpoints (see section 5 of the API Integration Overview): you are billed on actual usage from usage (reasoning tokens of reasoning models count toward output usage), platform-side interception and service failures are never charged, and a streaming request dropped by the client mid-way is billed on the final actual usage.
