# Layer X1 > Layer X1 is an agent-native model API: one key, one endpoint, the entire lx1 catalog. Drop-in compatible with the Anthropic and OpenAI APIs. ## Docs - [One API. Every model. Built for agent loops.](https://docs.layerx1.com/index.md): Layer X1 is a model API built for agents: point your tool at a single endpoint, authenticate with one key, and reach the entire Layer X1 model catalog through the protocols your stack already speaks. - [Key. Base URL. First call.](https://docs.layerx1.com/quickstart.md): Three steps from zero to a response. If you are wiring up a coding agent, one command does all three — see the fast paths at the bottom. - [The model catalog.](https://docs.layerx1.com/models.md): Every model in the catalog, with its tier, context window, capabilities, and per-million-token list pricing. Request one by name with the model field. - [Plans, usage, and limits.](https://docs.layerx1.com/plans.md): Every plan includes the entire model catalog behind one key. Plans differ on two published axes only: how much usage is included each month, and how fast you can push requests. - [One key, both protocols.](https://docs.layerx1.com/authentication.md): Every request is authenticated with a key that starts with lx1_. How you present it depends on which protocol you are speaking. - [The unified surface.](https://docs.layerx1.com/api/overview.md): One gateway, every protocol your tools already speak. Every endpoint lives under /v1 at a single origin, authenticated with one lx1_ key. - [Chat Completions.](https://docs.layerx1.com/api/chat-completions.md): The OpenAI Chat Completions dialect on the Layer X1 catalog. If your client speaks to OpenAI, it speaks to Layer X1 — swap the base URL and the key, keep everything else. - [Messages.](https://docs.layerx1.com/api/messages.md): The Anthropic Messages dialect on the Layer X1 catalog — the surface Claude Code and the Anthropic SDKs speak. Content blocks, tools, vision, and PDFs, with SSE streaming. - [Responses.](https://docs.layerx1.com/api/responses.md): The OpenAI Responses dialect on the Layer X1 catalog — the wire protocol the Codex CLI uses. Send input, receive typed output items, stream with SSE. - [Completions (legacy).](https://docs.layerx1.com/api/completions.md): The legacy OpenAI text-completions dialect — prompt in, text out. Supported so older tools keep working unmodified; new integrations should use Chat Completions. - [Embeddings.](https://docs.layerx1.com/api/embeddings.md): Vectors for retrieval and agent memory, next to your chat calls — same key, same origin. Seven models from 384 to 2048 dimensions, OpenAI-compatible. - [Count tokens.](https://docs.layerx1.com/api/count-tokens.md): A fast estimate of the input tokens a Messages request will consume — the endpoint context meters (including Claude Code's) call before sending. - [Batches.](https://docs.layerx1.com/api/batches.md): For offline and high-volume work: submit many requests in one call, poll until the batch ends, fetch results as JSONL. Two flavors of the same machinery — pick the one whose request shape your items use. - [List and retrieve models.](https://docs.layerx1.com/api/models-endpoint.md): GET /v1/models is the catalog, self-describing and always authoritative. Every entry carries its capabilities, limits, list pricing, and the parameters it accepts — so a client can decide what to send without a hard-coded table. - [Predictable failures.](https://docs.layerx1.com/errors.md): The API returns standard HTTP status codes with a JSON error body shaped for the protocol you called — Anthropic-shaped on /v1/messages, OpenAI-shaped on the OpenAI endpoints. Match on the status; read error.message for the human explanation. - [Response headers.](https://docs.layerx1.com/headers.md): The API keeps its header surface small and stable: which model served you, where your request window stands, and — when you're asked to slow down — exactly how long to wait. - [Agent Runs.](https://docs.layerx1.com/api/agent-runs.md): A run is a durable, server-side record of one agent task: submit it once, follow its event stream, cancel it, and read the outcome back later. The chat endpoints are a single turn; a run is the whole job. - [Artifacts.](https://docs.layerx1.com/api/artifacts.md): Store a large result once, then query it instead of re-reading it. Artifacts let an agent keep a 40,000-row CSV out of the context window and pull back only the rows it needs. - [Claude Code on Layer X1.](https://docs.layerx1.com/guides/claude-code.md): Claude Code speaks the Anthropic Messages dialect natively — pointing it at Layer X1 is four environment variables, or one command. - [Codex CLI on Layer X1.](https://docs.layerx1.com/guides/codex.md): Codex talks the OpenAI Responses protocol. One provider block in config.toml points it at the gateway; the key lives in that block so Desktop and new terminals work without an env var. - [Cursor on Layer X1.](https://docs.layerx1.com/guides/cursor.md): Cursor's models settings accept an OpenAI-compatible override — point the OpenAI base URL at the gateway, paste your key, and add lx1 model names. - [Every other agent — exact config.](https://docs.layerx1.com/guides/other-tools.md): If a tool has an OpenAI-compatible setting, it runs on Layer X1: an API base pointed at the gateway, an lx1_ key, and a catalog model id. Copy-paste config for a dozen popular agents below — terminal-first, then editors. - [Moving an existing app over.](https://docs.layerx1.com/guides/migrating.md): You already have code calling OpenAI, Anthropic, or an aggregator. Here is exactly what changes — usually two lines — and the handful of things worth checking before you cut traffic over. - [Streaming.](https://docs.layerx1.com/guides/streaming.md): Every chat protocol streams over Server-Sent Events — set stream: true and consume tokens as they generate. Each dialect keeps its native event shape, so official SDKs work unchanged. - [Tool calling.](https://docs.layerx1.com/guides/tool-calling.md): Every model in the catalog calls tools, in both dialects, with strict schema-faithful arguments — the property agent loops live and die on. The loop is the same everywhere: define, receive a call, execute, return the result. - [Structured output.](https://docs.layerx1.com/guides/structured-output.md): When downstream code parses the answer, ask for the shape up front. Three patterns, strongest first: a JSON schema, plain JSON mode, or a tool schema on the Messages dialect. - [Prompt caching.](https://docs.layerx1.com/guides/prompt-caching.md): Agent sessions resend the same context every turn — the system prompt, the attached documents, the conversation so far. On models that publish a cached input rate, that repeated context is recognized and served from cache automatically and counts at the published cached rate instead of the full inpu… - [Which model actually serves you.](https://docs.layerx1.com/guides/model-routing.md): What the model field accepts — canonical ids, aliases, bare names, and the stock ids your SDK already has baked in — plus what happens when you leave it out or set it to auto. - [Reasoning models.](https://docs.layerx1.com/guides/reasoning.md): Many models in the catalog think before they answer. Reasoning is hidden unless you ask for it — here is how to ask, in each dialect, and what changes about budgeting when you do. - [Images and documents.](https://docs.layerx1.com/guides/vision.md): Send an image in either dialect and a vision model reads it. Which models can is a smaller list than the catalog suggests — check the capability flag before you send, because a text-only model is a 400, not a shrug. - [One command to wire up your agent.](https://docs.layerx1.com/cli.md): npx layerx1 walks you from nothing to a working agent: pick your tools, install what's missing, choose models from the live catalog, paste your key, verify. It deep-merges into your existing files, keeps timestamped backups, and is safe to re-run. - [What you can rely on.](https://docs.layerx1.com/reliability.md): Layer X1 is built to be the boring part of your stack. This page is the contract: the behaviors you can design an agent around, stated as outcomes — not implementation. - [When something isn't working.](https://docs.layerx1.com/support.md): The failures people actually hit, in the order they hit them — what each one means and the one thing to change. Then how to reach us, and what to include so the first reply is the useful one. - [API reference](https://docs.layerx1.com/api/introduction.md): The unified surface — Anthropic Messages, OpenAI Chat Completions and Responses, legacy Completions, embeddings, token counting, the model catalog, and batches. - [GO LIVE](https://docs.layerx1.com/GO-LIVE.md)