POST /v1/responses
OpenAI Responses API compatible endpoint
Generate a response using the OpenAI Responses API format. This endpoint is an alternative to /v1/chat/completions with a different request/response shape.
⚠️ Known limitation
Tool calling is not yet supported on this endpoint. If you need tool calling, use /v1/chat/completions or /v1/messages instead.
Endpoint
POST https://api.runars.ca/v1/responsesAuthentication
Include your API key as a Bearer token:
-H "Authorization: Bearer sk-runars-..."Request body
For a comparison of common parameters across all endpoints, see Parameters Reference.
The Responses API uses input and instructions instead of the messages format:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model identifier, must be "glm-5.2" |
input | string | Yes | The user's input/prompt |
instructions | string | No | System instructions (similar to system prompt) |
max_tokens | integer | No | Maximum tokens in the response |
stream | boolean | No | Enable streaming (default: false) |
Response (non-streaming)
{
"id": "response_...",
"object": "response",
"created": 1234567890,
"model": "glm-5.2",
"output_text": "The response text here.",
"status": "completed",
"finish_reason": "stop"
}Response (streaming)
With stream: true, the endpoint returns server-sent events:
event: response.created
data: {"id":"response_...","object":"response","created":1234567890,"model":"glm-5.2"}
event: response.output_text.delta
data: {"object":"response.delta","delta":{"output_text":"The "}}
event: response.output_text.delta
data: {"object":"response.delta","delta":{"output_text":"response "}}
event: response.completed
data: {"object":"response.completed","id":"response_...","status":"completed","finish_reason":"stop"}Examples
Simple text request
curl https://api.runars.ca/v1/responses \
-H "Authorization: Bearer sk-runars-..." \
-H "content-type: application/json" \
-d '{
"model": "glm-5.2",
"input": "What is the capital of France?"
}'With instructions
curl https://api.runars.ca/v1/responses \
-H "Authorization: Bearer sk-runars-..." \
-H "content-type: application/json" \
-d '{
"model": "glm-5.2",
"instructions": "You are a helpful assistant. Keep responses concise.",
"input": "Explain quantum computing in one sentence."
}'Using the OpenAI SDK
import OpenAI from "openai"
const openai = new OpenAI({
baseURL: "https://api.runars.ca/v1",
apiKey: process.env.OPENAI_API_KEY,
})
const response = await openai.beta.responses.create({
model: "glm-5.2",
input: "Tell me a short story about a robot.",
max_tokens: 500,
})
console.log(response.output_text)Streaming
const stream = await openai.beta.responses.create({
model: "glm-5.2",
input: "Tell me a short story about a robot.",
stream: true,
})
for await (const event of stream) {
if (event.object === "response.output_text.delta") {
process.stdout.write(event.delta.output_text)
}
}Web search
Add OpenAI's web search tool and Runars executes the searches gateway-side:
{
"model": "glm-5.2",
"input": "What happened in the news today?",
"tools": [
{
"type": "web_search",
"search_context_size": "medium",
"filters": { "allowed_domains": ["example.com"] }
}
]
}- Output:
web_search_callitems (action.type: "search"with the query) precede the message item; the message'soutput_textcarriesurl_citationannotations for the sources used. - Usage:
usage.web_search_requestsreports the executed-search count. - Options:
search_context_size(low/medium/high→ how many results the model sees),filters.allowed_domains/blocked_domains, anduser_locationare honored.web_search_previewis accepted as an alias. - Billing: $10 / 1,000 executed searches (standard rate) plus normal token costs; errored searches are not billed. Rounds of
web_search_callitems in follow-upinputare accepted and skipped.
Comparison to /v1/chat/completions
| Aspect | Chat Completions | Responses |
|---|---|---|
| Request format | messages array | input string + instructions |
| Response format | choices[0].message.content | output_text |
| Multi-turn | ✅ (via message history) | ⚠️ (requires manual state) |
| Tool calling | ✅ | ❌ |
| Streaming events | chat.completion.chunk | response.* events |
Use /v1/responses if:
- You prefer the simpler
input/output_textAPI shape - You're porting code from a different API that uses this format
- You don't need tool calling
Use /v1/chat/completions if:
- You need tool calling
- You're building multi-turn conversations
- You're using the OpenAI SDK
Error responses
400 Bad Request
Missing required field:
{
"error": {
"message": "Invalid request: missing required field 'input'",
"type": "invalid_request_error"
}
}401 Unauthorized
Invalid or missing API key:
{
"error": {
"message": "Unauthorized",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}429 Too Many Requests
Rate limit exceeded:
{
"error": {
"message": "Rate limit exceeded",
"type": "server_error",
"code": "insufficient_quota"
}
}Future roadmap
Tool calling support is planned for this endpoint. In the meantime, use /v1/chat/completions or /v1/messages if you need tools.