Responses
POST /v1/responses — OpenAI Responses API compatible endpoint for Codex CLI and other Responses API clients
Create a model response using the OpenAI Responses API shape. Drop-in replacement for the OpenAI Responses API — designed for Codex CLI and any client that speaks the Responses format.
Endpoint:
POST /v1/responsesAuth: Bearer token or x-api-key. Requires scope inference.chat.
Melious is stateless. store is always false, previous_response_id is rejected, and GET/DELETE /v1/responses/{id} return 404. Include the full conversation history in every request.
Example
from openai import OpenAI
client = OpenAI(
api_key="sk-mel-<YOUR_API_KEY>",
base_url="https://api.melious.ai/v1",
)
response = client.responses.create(
model="glm-5.2",
input="Name three Hanseatic cities.",
)
print(response.output_text)curl https://api.melious.ai/v1/responses \
-H "Authorization: Bearer sk-mel-<KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "glm-5.2",
"input": "Name three Hanseatic cities."
}'export OPENAI_API_KEY="sk-mel-<YOUR_API_KEY>"
export OPENAI_BASE_URL="https://api.melious.ai/v1"
codex # Works transparentlyRequest
Core parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
model | string | — | Model ID, optionally with a flavor suffix like :eco or :free. See Routing. |
input | string | array | — | The conversation input. String for a single user message, or a list of input items (see below). |
instructions | string | none | System-level instructions. Prepended as a system message. Equivalent to the system role in Chat Completions. |
max_output_tokens | integer | model max | Caps the completion length. Maps to max_tokens internally. |
temperature | number | model default | Sampling temperature, [0, 2]. |
top_p | number | 1 | Nucleus sampling cutoff, [0, 1]. |
frequency_penalty | number | 0 | Penalize repeated tokens, [-2, 2]. |
presence_penalty | number | 0 | Penalize tokens already present, [-2, 2]. |
stop | string | array | null | Stop sequences. |
seed | integer | none | Deterministic sampling (best-effort — not all providers honor it). |
user | string | none | End-user identifier for abuse monitoring. |
Stateless gateway
| Parameter | Type | Default | Description |
|---|---|---|---|
store | boolean | false | Accepted but always treated as false. Melious does not store responses server-side. |
previous_response_id | string | — | Rejected with 400. Include the full conversation history in input instead. |
Streaming
| Parameter | Type | Default | Description |
|---|---|---|---|
stream | boolean | false | Enable SSE streaming with Responses-format events. |
See Streaming for the general streaming shape. Events are converted to native Responses API SSE format (response.output_text.delta, response.completed, etc.).
Reasoning
| Parameter | Type | Default | Description |
|---|---|---|---|
reasoning | object | none | { "effort": "low" | "medium" | "high" }. Controls reasoning depth on reasoning models. Ignored by non-reasoning models. |
Tools
| Parameter | Type | Default | Description |
|---|---|---|---|
tools | array | null | Tool definitions the model may call. Supports function, file_search, web_search, web_search_preview, shell, function_shell, apply_patch. |
tool_choice | string | object | "auto" | \"auto\", \"none\", \"required\", or a specific tool reference. |
parallel_tool_calls | boolean | true | Whether the model may call multiple tools in one response. |
Tool types computer_use, code_interpreter, and mcp are not supported — they require server-side execution environments Melious does not host. Requests containing them are rejected with a validation error.
input items
When input is a list, each item is one of:
Message item:
{
"type": "message",
"role": "user",
"content": "What's in this image?"
}content can be a string or an array of content parts (text, image). Image parts use the same image_url format as Chat Completions — public URLs and base64 data URIs are both accepted.
Function call item (assistant tool call):
{
"type": "function_call",
"call_id": "call_abc",
"name": "get_weather",
"arguments": "{\"city\": \"Hamburg\"}"
}Function call output item (tool result):
{
"type": "function_call_output",
"call_id": "call_abc",
"output": "{\"temp\": 22}"
}Item reference: { "type": "item_reference", "id": "..." } — rejected (no server-side state).
Response
{
"id": "resp-...",
"object": "response",
"created_at": 1699999999,
"model": "glm-5.2",
"status": "completed",
"output": [
{
"type": "message",
"id": "msg_...",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "Hamburg, Lübeck, Bremen." }
],
"status": "completed"
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 7,
"total_tokens": 19
},
"store": false,
"environment_impact": {
"energy_kwh": 0.00015,
"carbon_g_co2": 0.06,
"water_liters": 0.0002,
"renewable_percent": 85,
"pue": 1.18,
"provider_id": "ovhcloud",
"location": "FR"
},
"billing_cost": {
"energy": "0.0008",
"credits": "0.0",
"paid_with": "energy"
}
}output
Array of output items. The most common is a message item with content containing output_text parts. For tool calls, function_call items appear in the array.
status
completed— model finished normally.failed— provider error or content filter.
environment_impact and billing_cost
Same Melious-specific fields as Chat completions. See Environmental impact and Pricing.
Stateless behavior
| Feature | OpenAI | Melious |
|---|---|---|
store: true | Stores response server-side | Ignored — always false |
previous_response_id | Resumes from stored conversation | Rejected with 400 |
GET /v1/responses/{id} | Retrieves stored response | Returns 404 |
DELETE /v1/responses/{id} | Deletes stored response | Returns 404 |
Send the full conversation as input on every call. This matches how Codex CLI and most Responses API clients operate in practice.
Errors
Every error returns the standard {"error": {"code", "message", "details"}} shape. Common codes on this endpoint:
VALIDATION_4002—modelorinputmissing.VALIDATION_4001—previous_response_idprovided (stateless gateway rejects it).INFERENCE_3001— unknown model ID.INFERENCE_3207— input exceeds the model's context window.INFERENCE_3103— all providers failed (transient; retry).BILLING_2001/BILLING_2003— out of energy / credits.AUTH_1015— key is missinginference.chatscope.
Full list and retry guidance: Errors.
Related
Chat completions • Streaming • Tool calling • Routing • Codex CLI integration