Responses API
EmberCloud implements the OpenAI Responses API at POST /v1/responses. It exists so that tools that only speak the Responses protocol — most notably OpenAI Codex — can run on EmberCloud's open-source models with no code changes.
Under the hood this endpoint is a thin translation layer: it converts your Responses request into a Chat Completions request, runs it through the same routing, billing, and streaming pipeline, then converts the result back into the Responses shape. You are billed exactly once, at the same per-token rates as /v1/chat/completions.
Looking to wire up a coding agent? See the Codex and Claude Code guides for ready-to-paste configuration.
Endpoint
Authenticate with your EmberCloud API key via the Authorization header, exactly like every other endpoint.
POST https://api.embercloud.ai/v1/responses
Making Requests
Point any OpenAI SDK at the EmberCloud base URL and call responses.create. The only required field is input.
from openai import OpenAI
client = OpenAI(
base_url="https://api.embercloud.ai/v1",
api_key="YOUR_API_KEY",
)
response = client.responses.create(
model="glm-4.7",
instructions="You are a concise coding assistant.",
input="Write a haiku about fast GPUs.",
)
print(response.output_text)Supported parameters
| Field | Type | Notes |
|---|---|---|
| input | string | array | Required. A plain string, or an array of message, function_call, and function_call_output items. |
| model | string | Defaults to glm-4.7. See Models. |
| instructions | string | System prompt prepended to the conversation. |
| tools | array | Function tools only (type: "function"). See Tool Calling. |
| tool_choice | string | object | auto, none, required, or a named function. |
| max_output_tokens | integer | Caps the visible output length. |
| temperature | number | Sampling temperature. |
| top_p | number | Nucleus sampling. |
| stream | boolean | Stream the response as server-sent events. |
Response Object
A non-streaming call returns a response object. Assistant text is delivered as an output_text part inside a message item; tool calls appear as function_call items.
{
"id": "resp_8f1c...",
"object": "response",
"created_at": 1718668800,
"status": "completed",
"model": "glm-4.7",
"output": [
{
"type": "message",
"id": "msg_2a9d...",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Silicon ablaze / tokens stream like summer rain / answers in a blink",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 24,
"input_tokens_details": { "cached_tokens": 0 },
"output_tokens": 21,
"output_tokens_details": { "reasoning_tokens": 0 },
"total_tokens": 45
}
}When the model is cut off by max_output_tokens, status is incomplete and incomplete_details.reason is max_output_tokens.
Streaming
Set stream: true to receive standard Responses server-sent events. The stream opens with response.created / response.in_progress, emits response.output_text.delta (and response.function_call_arguments.delta for tools) as content arrives, and closes with response.completed.
stream = client.responses.create(
model="glm-4.7",
input="Stream me a limerick about latency.",
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)Limitations
The Responses endpoint covers the surface coding agents need. A few parts of the full OpenAI spec are intentionally not supported:
- •Stateless only. There is no server-side conversation store, so
storeandprevious_response_idare not used. Send the full conversation ininputon every turn (this is how Codex already operates). - •Function tools only. Hosted tools like web search, file search, and code interpreter are not available — only
type: "function"tools. - •No separate reasoning items. The
reasoningfield is accepted but does not produce dedicated reasoning output on this endpoint. For visible chain-of-thought, use Chat Completions with reasoning. - •Text and tools. Image and other non-text input parts are ignored; the endpoint operates on text and function calls.