API reference

The unified surface.

One gateway, every protocol your tools already speak. Every endpoint lives under /v1 at a single origin, authenticated with one lx1_ key.

Base URL

All endpoints below are relative to:

https://api.layerx1.in

Authentication is one key across the whole surface — see Authentication for which header each dialect expects.

Endpoints

EndpointWhat it does
POST/v1/chat/completionsOpenAI Chat Completions dialect — messages in, completion out. SSE streaming.
POST/v1/messagesAnthropic Messages dialect — content blocks, tools, vision + PDFs. SSE streaming.
POST/v1/responsesOpenAI Responses dialect — the surface Codex CLI speaks. SSE streaming.
POST/v1/completionsLegacy text completions for older clients — prompt in, text out.
POST/v1/embeddings768-dimensional embeddings with lx1-embed — memory and retrieval next to chat.
POST/v1/messages/count_tokensToken estimate for a Messages request body, for context budgeting.
POST/v1/messages/batchesAsync batches — up to 1,000 requests per submission, results as JSONL.
GET/v1/modelsThe self-describing model catalog: ids, capabilities, limits, list pricing.
Note

GET /v1/models/{id} returns a single catalog entry. Batches also exist in an OpenAI flavor at /v1/batches with the same lifecycle — see Batches.

Conventions

Errors are standard HTTP status codes with a JSON body shaped for the protocol you called (Errors). Responses carry a small, fixed set of x1- and x-ratelimit- headers (Headers). Streaming is Server-Sent Events on every chat endpoint (Streaming).