Chat & text

POST /v1/chat/completions is an OpenAI-compatible endpoint. Request and response mirror OpenAI, so existing code changes only its baseURL and key.

POST /v1/chat/completions a synchronous or streamed model answer

Request

Only messages is required. Every other OpenAI field (temperature, max_tokens, top_p, stop and the rest) is forwarded to the provider verbatim — the gateway neither interprets nor validates them.

FieldTypeDescription
messagesarrayRequired. OpenAI-shaped messages: role + content. Missing or non-array → 400.
modelstringA catalog model id such as gpt-5 or gpt-5-mini. Defaults to default, letting the gateway pick an available text model.
streambooleantrue → the answer arrives over SSE. See Streaming.
anyAny other OpenAI field is passed through untouched.
curl https://mintform.app/v1/chat/completions \
  -H "Authorization: Bearer mf_live_…" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-5-mini",
  "messages": [
    {
      "role": "user",
      "content": "Explain a circuit breaker in one paragraph"
    }
  ]
}'

Response

This is the one public endpoint without the {success, code, data, error} envelope: both success and failure come back in raw OpenAI shape.

{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "gpt-5-mini",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "A circuit breaker trips…" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 24, "completion_tokens": 96, "total_tokens": 120 }
}

Images as input (vision)

References travel as OpenAI-vision content parts. image_url.url accepts either an http(s) link or an inline data-URI; the two forms are interchangeable and can be mixed in one message.

{
  "model": "gpt-5",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "What is on this image?" },
        { "type": "image_url", "image_url": { "url": "https://example.com/photo.png" } }
      ]
    }
  ]
}
{
  "model": "gpt-5",
  "messages": [
    {
      "role": "user",
      "content": [
        { "type": "text", "text": "Describe this reference in detail" },
        { "type": "image_url",
          "image_url": { "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA…" } }
      ]
    }
  ]
}

Errors

Errors from this endpoint are also OpenAI-shaped. The full kind map and retry strategy live in Errors.

HTTPWhen
400messages is missing or is not an array.
401The key is missing, revoked or invalid.
429Your plan rpm, concurrency or daily quota is exhausted.
502Every eligible provider failed.
503No healthy text provider is available.
{
  "error": {
    "message": "rate limit exceeded (rpm)",
    "type": "invalid_request_error"
  }
}

Tokens and usage

On a non-streamed answer the usage block comes from the provider. While streaming, usage appears only if the upstream sends it — do not bill on it: the cabinet counts requests, not tokens.