Skip to content

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 the input / instructions / reasoning parameter shape. The chat model list is whatever GET /v1/models returns.

1. Quick Start (Non-Streaming) ​

bash
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).

python
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):

bash
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:

EventMeaning
response.createdResponse started
response.output_item.addedAn output item (answer message / reasoning / tool call) begins
response.output_text.deltaAnswer text delta (the delta field holds a text fragment; concatenate frame by frame)
response.output_item.doneThat output item ends
response.completedResponse 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.

python
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 parameterChat equivalentDescription
inputmessagesA string, or an array of message items (role + content); semantics match messages
instructionssystem messageA separate top-level field, placed before the conversation as system-level instructions
max_output_tokensmax_tokensOutput limit
reasoning.effortreasoning_effortReasoning level: low / medium / high (only effective on reasoning models)
toolstoolsTools are declared in a flat shape (type: "function", with no nested function layer)
streamstreamStreaming 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.

Public documentation for platform users