MisarMisar Docs

Authentication

Authenticate requests to the MisarCoder gateway with a bearer API key.

MisarCoder authenticates every request with a bearer API key.

Bearer token

Send your key in the Authorization header:

Authorization: Bearer YOUR_MISARCODER_API_KEY

Anthropic-style header

The /v1/messages endpoint additionally accepts the Anthropic x-api-key: YOUR_MISARCODER_API_KEY header, so the stock Anthropic SDK works unchanged. If both Authorization and x-api-key are present, Authorization takes precedence.

How validation works

  • When the gateway is configured with an API key, requests without a valid bearer token are rejected with 401 Unauthorized.
  • Token comparison is constant-time.
  • If the gateway is deployed without a configured key (local/dev mode), authentication is skipped and all requests are accepted. Do not run a public deployment without a key.

claude-* passthrough

When you call /v1/messages with a claude-* model, the gateway forwards your request directly to Anthropic and uses the bearer token you supplied as the upstream x-api-key. In that case the token must be a valid Anthropic API key. For all non-claude-* models the token is validated against the gateway's own key and the request is routed through the internal MoE engine.

Errors

StatusMeaning
401Missing or invalid API key.
503Model router not initialized (gateway still starting up).
502Upstream provider error.
504Request timed out.