Responses (OpenAI)
The Responses endpoint is OpenAI Responses API-compatible (protocol id
openai-response). Use it with GPT-5 and other models that only support the
Responses protocol, or any model in the catalog tagged with this protocol.
POST https://api.smartapi.cc/api/openapi/v1/responsesAuthentication#
Same as Chat Completions:
Authorization: Bearer sk-your-key-here
Content-Type: application/jsonDifferences from Chat Completions#
| Aspect | Chat Completions | Responses |
|---|---|---|
| Path | /chat/completions | /responses |
| Conversation | messages | input |
| System prompt | system in messages | instructions (optional) |
| Stream events | choices[].delta | response.output_text.delta, etc. |
| Usage fields | usage.prompt_tokens | usage.input_tokens |
Only model is validated by SmartAPI; all other fields are forwarded to the
upstream provider unchanged. Use the same request body as the OpenAI Responses
API.
Request body#
Common fields:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model identifier, e.g. gpt-5. |
input | array | Yes | Conversation input — a string or an array of {role, content}. |
instructions | string | No | System-level instructions (system prompt). |
stream | boolean | No | Stream as server-sent events. Defaults to false. |
max_output_tokens | integer | No | Maximum output tokens to generate. |
Thinking / Reasoning#
Models that support reasoning accept a reasoning object:
| Field | Type | Description |
|---|---|---|
reasoning.effort | string | Reasoning level: none / low / medium / high, per upstream. |
{
"model": "gpt-5",
"input": [{ "role": "user", "content": "Hello" }],
"reasoning": { "effort": "medium" }
}Basic example#
curl https://api.smartapi.cc/api/openapi/v1/responses \
-H "Authorization: Bearer $SMARTAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5",
"instructions": "You are a helpful assistant.",
"input": [
{ "role": "user", "content": "What is SmartAPI?" }
]
}'Response#
{
"id": "resp_...",
"object": "response",
"status": "completed",
"model": "gpt-5",
"output_text": "SmartAPI is...",
"usage": {
"input_tokens": 24,
"output_tokens": 88,
"total_tokens": 112
}
}Some upstreams return structured content in an output array; SmartAPI forwards
it unchanged.
Streaming#
Set stream to true to receive incremental output as text/event-stream.
Text deltas use the response.output_text.delta event type. The stream ends
with a response.completed event that carries response.usage.
from openai import OpenAI
client = OpenAI(
api_key="sk-your-key-here",
base_url="https://api.smartapi.cc/api/openapi/v1",
)
stream = client.responses.create(
model="gpt-5",
input=[{"role": "user", "content": "Write a haiku about APIs."}],
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="")Typical SSE chunks:
data: {"type":"response.output_text.delta","delta":"Hello"}
data: {"type":"response.completed","response":{"usage":{"input_tokens":2,"output_tokens":33,"total_tokens":35}}}Usage and billing#
Non-streaming responses read usage from the top-level usage object. Streaming
reads it from response.usage inside the response.completed event. Fields are
input_tokens, output_tokens, and total_tokens (some upstreams also accept
prompt_tokens / completion_tokens).
When the upstream omits token usage, SmartAPI estimates input/output from the request and response text before billing. See billing for details.