Melious
API Reference

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/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
modelstringModel ID, optionally with a flavor suffix like :eco or :free. See Routing.
inputstring | arrayThe 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. Maps to max_tokens internally.
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_idstringRejected 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 are converted to native Responses API SSE format (response.output_text.delta, response.completed, etc.).

Reasoning

ParameterTypeDefaultDescription
reasoningobjectnone{ "effort": "low" | "medium" | "high" }. Controls reasoning depth on reasoning models. Ignored by non-reasoning models.

Tools

ParameterTypeDefaultDescription
toolsarraynullTool definitions the model may call. Supports function, file_search, web_search, web_search_preview, shell, function_shell, apply_patch.
tool_choicestring | object"auto"\"auto\", \"none\", \"required\", or a specific tool reference.
parallel_tool_callsbooleantrueWhether 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

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

Every error returns the standard {"error": {"code", "message", "details"}} shape. Common codes on this endpoint:

  • VALIDATION_4002model or input missing.
  • VALIDATION_4001previous_response_id provided (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 missing inference.chat scope.

Full list and retry guidance: Errors.

Chat completionsStreamingTool callingRoutingCodex CLI integration

On this page