Skip to main content
The /v1/messages endpoint mirrors the Anthropic Messages API, letting you use the official anthropic Python or TypeScript SDK — or any Anthropic-compatible client — without code changes. Point the client at https://api.meliai.ai with your sk-mel-<KEY> API key and every request is routed across Meliai’s European provider network. Claude model identifiers such as claude-sonnet-4 are accepted as aliases and mapped to equivalent open-weight models running entirely on EU infrastructure.
Claude model names (e.g. claude-sonnet-4) are logical aliases mapped to capable open-weight equivalents. No Anthropic infrastructure is involved — your data stays within the EU at all times.

Endpoint

Authorization: Bearer sk-mel-<KEY> via Authorization header, or x-api-key: sk-mel-<KEY>.

Parameters

string
required
Model ID to use. You may pass an Anthropic-style alias (e.g. "claude-sonnet-4") or a direct open-weight model ID. Append a routing flavor suffix such as :speed or :eco to control provider selection.
array
required
Conversation turns in Anthropic format. Each object requires:
  • role"user" or "assistant"
  • content — a string, or an array of content blocks (text, image, tool_use, tool_result)
integer
required
Maximum number of tokens to generate. Anthropic’s API treats this field as required; include it on every request.
string
System prompt placed before the conversation. Equivalent to a {"role": "system", ...} message in the OpenAI format.
number
Sampling temperature in [0, 1]. Higher values increase output diversity. Defaults to the model’s built-in default.
boolean
When true, the response streams as SSE events using the Anthropic streaming format. Default: false.
array
Tool definitions following the Anthropic tool-calling schema. Each tool object contains name, description, and input_schema (a JSON Schema object).
object
Controls tool invocation. Anthropic-format object with a type field: "auto", "any", or "tool" (plus name when specifying a particular tool).

Examples

Basic chat

Streaming


Token Count Preflight

Use POST /v1/messages/count_tokens to estimate the token count for a request before sending it. The endpoint accepts the same body as /v1/messages and returns a count without consuming any generation credits.
Response:

Response

A successful non-streaming response returns HTTP 200 with the Anthropic Messages response shape, extended with Meliai’s environment_impact and billing_cost fields.
All inference runs on GDPR-compliant European infrastructure. Your prompts and completions are never used to train any model.