Skip to content
LLMFLUX

API reference · Anthropic

Messages

Anthropic-format inference through your LLMFLUX gateway key.

Endpoint

POST /v1/messages

Send Content-Type: application/json and either Authorization: Bearer YOUR_KEY or x-api-key: YOUR_KEY. Authorization takes precedence. Use a server-side environment variable, never a browser bundle.

Request body

FieldBehavior
modelRequired gateway selector. An enabled canonical ID or configured alias from GET /v1/models.
messagesAnthropic-format input, validated by the upstream provider.
max_tokensAnthropic-format output limit; include a positive integer.
streamOnly literal JSON true enables SSE. Otherwise the gateway explicitly sends false upstream.

Send messages as an array of user/assistant turns with text or supported content blocks, plus max_tokens. Use the top-level system field for system instructions. A typical result contains content blocks, stop_reason and usage.input_tokens/output_tokens. Feature support is provider-specific. The gateway does not require anthropic-version and does not forward customer headers upstream; the Anthropic SDK may send its normal version header.

Compatibility boundary. The gateway resolves the model and forwards the JSON body; it does not translate all model capabilities or validate every provider field. Discovery metadata is descriptive, not a guarantee that every endpoint or tool works for every model.

Example request

Replace YOUR_MODEL_ID with a compatible live ID. SDK examples read LLMFLUX_MODEL and LLMFLUX_API_KEY from your environment.

One gateway key reaches every enabled provider through this path.

curl https://api.llmflux.dev/v1/messages \
  -H "Authorization: Bearer $LLMFLUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "YOUR_MODEL_ID",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Hello from LLMFLUX"
    }
  ],
  "stream": false
}'

Response and streaming

Successful non-streaming requests return HTTP 200 and the provider JSON payload, not a new gateway response schema. Token usage is recorded against your account. Set stream: true for SSE streaming.

Errors and limits

Inference requires an active key, any required Telegram verification, a positive account balance and available plan allowance. The per-user inference throttle is 120 requests per minute across keys. Bodies are limited to 25 MB. See error codes for handling 401, 402, 403, 404, 429 and provider failures.