API reference · Authentication

One key, both protocols.

Every request is authenticated with a key that starts with lx1_. How you present it depends on which protocol you are speaking.

Getting a key

Keys are created and revoked in the dashboard under /dashboard/keys. A key is shown once at creation — store it somewhere safe. Keys are always prefixed lx1_.

Note

Treat keys as secrets. Set them through environment variables rather than committing them, and rotate from the dashboard if one leaks.

How to present the key

ProtocolEndpointHeader
Anthropic Messages/v1/messagesx-api-key: lx1_...
OpenAI Chat Completions/v1/chat/completionsAuthorization: Bearer lx1_...
OpenAI Responses/v1/responsesAuthorization: Bearer lx1_...
Embeddings / Completions / Batches/v1/...Authorization: Bearer lx1_...

The Anthropic endpoint also accepts Authorization: Bearer lx1_... as an alternative to x-api-key, which is convenient when a client only lets you set one auth header.

Examples

curl https://api.layerx1.in/v1/messages \
  -H "x-api-key: lx1_your_key" \
  -H "content-type: application/json" \
  -d '{"model":"lx1-gpt-oss-120b","max_tokens":256,"messages":[{"role":"user","content":"Hi"}]}'
Anthropic — x-api-key
curl https://api.layerx1.in/v1/chat/completions \
  -H "authorization: Bearer lx1_your_key" \
  -H "content-type: application/json" \
  -d '{"model":"lx1-gpt-oss-120b","messages":[{"role":"user","content":"Hi"}]}'
OpenAI — Authorization: Bearer

Failure modes

  • A missing or malformed key returns 401 with an error body shaped for the protocol you called.
  • A valid key naming a model that does not exist in the catalog returns 404 — check the id against GET /v1/models.

See Errors for the full status-code reference and body shapes.