Melious

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/responses

Auth: 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 transparently

Request

Core parameters

ParameterTypeDefaultDescription
modelstring—Model ID, optionally with a routing flavor suffix like :eco. See Routing.
inputstring | array—The conversation input. String for a single user message, or a list of input items (see below).
instructionsstringnoneSystem-level instructions. Prepended as a system message. Equivalent to the system role in Chat Completions.
max_output_tokensintegermodel maxCaps the completion length.
temperaturenumbermodel defaultSampling temperature, [0, 2].
top_pnumber1Nucleus sampling cutoff, [0, 1].
frequency_penaltynumber0Penalize repeated tokens, [-2, 2].
presence_penaltynumber0Penalize tokens already present, [-2, 2].
stopstring | arraynullStop sequences.
seedintegernoneDeterministic sampling (best-effort — not all providers honor it).
userstringnoneEnd-user identifier for abuse monitoring.

Stateless gateway

ParameterTypeDefaultDescription
storebooleanfalseAccepted but always treated as false. Melious does not store responses server-side.
previous_response_idstring—Rejected with 400. Include the full conversation history in input instead.

Streaming

ParameterTypeDefaultDescription
streambooleanfalseEnable SSE streaming with Responses-format events.

See Streaming for the general streaming shape. Events follow the official Responses API lifecycle, so the OpenAI SDK's client.responses.stream() helper works against it.

A stream opens with response.created and response.in_progress. A text answer is one message item: response.output_item.added, response.content_part.added, one response.output_text.delta per chunk, then response.output_text.done, response.content_part.done, and response.output_item.done. Tool calls follow as further items — response.output_item.added, response.function_call_arguments.delta, response.function_call_arguments.done, response.output_item.done — with consecutive output_index values.

Every stream ends with one of three terminal events, then data: [DONE]: response.completed on a normal finish, response.incomplete when the output was cut off (incomplete_details.reason is max_output_tokens or content_filter), or response.failed followed by an error event when the request fails. Treat a stream that ends with none of the three as failed — it was cut off. Our failure event used to carry a non-standard name; if you wrote a raw consumer against it, match on error now.

Reasoning

ParameterTypeDefaultDescription
reasoningobjectmodel default{"effort": "..."} with none, minimal, low, medium, high, xhigh, or max (lowercase). Any other value is ignored and the model default applies — you don't get a 400. We fold these to three levels before they reach the model: minimal → low, xhigh and max → high; none turns reasoning off. Only glm-5.3 and glm-5.3-flash receive xhigh/max as sent.

Tools

ParameterTypeDefaultDescription
toolsarraynullTool definitions the model may call. Supports function, file_search, web_search, web_search_preview, shell, function_shell, apply_patch. A function tool's strict reaches the provider as you sent it.
tool_choicestring | object"auto"\"auto\", \"none\", \"required\", or a specific tool reference.
parallel_tool_callsbooleanprovider defaultForwarded to the provider when true or false, and echoed in the response only then. Absent, null, or non-boolean values are ignored, not rejected. We forward the flag; whether the engine enforces it is the engine's call.

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.

Structured output

ParameterTypeDefaultDescription
textobjectnull{"format": {"type": "json_object"}} for JSON mode, or {"format": {"type": "json_schema", "name": "...", "schema": {...}, "strict": true, "description": "..."}} — the flat shape client.responses.parse() sends. The nested {"type": "json_schema", "json_schema": {...}} shape is still accepted. json_schema needs _meta.capabilities.json_schema; other models answer 400 before a stream starts.

Walkthrough: Structured outputs.

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), kept in the order you send them; an image part's detail is forwarded. 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).

Reasoning item: { "type": "reasoning", ... } in either the summary or the content shape — dropped, never replayed to the model as assistant text. An input made only of reasoning items needs instructions, or the request fails validation.

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,
    "input_tokens_details": { "cached_tokens": 0 },
    "output_tokens": 7,
    "output_tokens_details": { "reasoning_tokens": 0 },
    "total_tokens": 19
  },
  "store": false
}

output

Array of output items. A message item carries the answer as output_text parts; function_call items carry tool calls. Reasoning models put a reasoning item first ({"type": "reasoning", "summary": [{"type": "summary_text", "text": "..."}]}), so don't read output[0] as the message — use response.output_text or pick the item by type. Streams never carry the reasoning item.

usage

Always carries input_tokens_details.cached_tokens and output_tokens_details.reasoning_tokens — 0 when the provider reported neither. On a stream, usage arrives on the terminal event; response.failed carries none.

created_at

A real Unix time in seconds: the provider's on a JSON response, and on a stream the moment we started converting it — the same value on every response object of that stream.

status

  • completed — model finished normally. On a stream: response.completed.
  • incomplete — output was cut off; incomplete_details.reason is max_output_tokens or content_filter. On a stream: response.incomplete, never response.completed.
  • failed — the request failed after the stream started (a provider error, or a billing or capacity refusal). On a stream: response.failed, then an error event, never response.completed. A non-streamed request that fails returns an HTTP error instead.

No environment_impact or billing_cost

Responses carry neither Melious extension — not in the non-streamed body, and not in any stream event, including response.completed. Requests are still metered and billed; among conversational endpoints, Chat completions returns both fields. See Environmental impact and Pricing.

Stateless behavior

FeatureOpenAIMelious
store: trueStores response server-sideIgnored — always false
previous_response_idResumes from stored conversationRejected with 400
GET /v1/responses/{id}Retrieves stored responseReturns 404
DELETE /v1/responses/{id}Deletes stored responseReturns 404

Send the full conversation as input on every call. This matches how Codex CLI and most Responses API clients operate in practice.

Errors

Errors use the OpenAI shape — {"error": {"message", "type", "param", "code"}}. Here error.code carries the public code when one exists and otherwise repeats the type. These are endpoint-level errors. Account-level throttling uses a flat 429 with code RATE_LIMIT_EXCEEDED; see Errors. Common statuses:

StatustypeMeaning
400invalid_request_errorMalformed request (including previous_response_id), capability or context mismatch.
401authentication_errorMissing or invalid API key.
403permission_denied_errorBilling refusal, or the key can't call this endpoint.
404not_found_errorUnknown model ID.
429rate_limit_exceededThrottled — back off per Retry-After.
503server_errorTransient — retry with backoff.

Two statuses on this endpoint don't use the shape above. A missing or invalid key (401) and a key without the inference.chat scope (403) return a flat body: {"code": "AUTH_1008", "message": "...", "request_id": "..."} — AUTH_1007 for no key, AUTH_1008 for an invalid key, AUTH_1015 for a missing scope. Match on code. A body that isn't valid JSON gets the same flat shape with a 400.

A billing refusal is the 403 permission_denied_error here — the same refusal is a 429 on Chat Completions. Full tables and retry guidance: Errors.

Chat completions • Streaming • Tool calling • Routing • Codex CLI integration

On this page