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.inAuthentication is one key across the whole surface — see Authentication for which header each dialect expects.
Endpoints
| Endpoint | What it does |
|---|---|
POST/v1/chat/completions | OpenAI Chat Completions dialect — messages in, completion out. SSE streaming. |
POST/v1/messages | Anthropic Messages dialect — content blocks, tools, vision + PDFs. SSE streaming. |
POST/v1/responses | OpenAI Responses dialect — the surface Codex CLI speaks. SSE streaming. |
POST/v1/completions | Legacy text completions for older clients — prompt in, text out. |
POST/v1/embeddings | 768-dimensional embeddings with lx1-embed — memory and retrieval next to chat. |
POST/v1/messages/count_tokens | Token estimate for a Messages request body, for context budgeting. |
POST/v1/messages/batches | Async batches — up to 1,000 requests per submission, results as JSONL. |
GET/v1/models | The 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).