> ## Documentation Index
> Fetch the complete documentation index at: https://docs.layerx1.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.com
```

Authentication is one key across the whole surface — see
[Authentication](/authentication) for which header each dialect expects.

## Endpoints

| Endpoint                                                | What it does                                                                        |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| `POST` [`/v1/chat/completions`](/api/chat-completions)  | OpenAI Chat Completions dialect — messages in, completion out. SSE streaming.       |
| `POST` [`/v1/messages`](/api/messages)                  | Anthropic Messages dialect — content blocks, tools, vision + PDFs. SSE streaming.   |
| `POST` [`/v1/responses`](/api/responses)                | OpenAI Responses dialect — the surface Codex CLI speaks. SSE streaming.             |
| `POST` [`/v1/completions`](/api/completions)            | Legacy text completions for older clients — prompt in, text out.                    |
| `POST` [`/v1/embeddings`](/api/embeddings)              | Seven embedding models, 384 to 2048 dimensions — memory and retrieval next to chat. |
| `POST` [`/v1/messages/count_tokens`](/api/count-tokens) | Token estimate for a Messages request body, for context budgeting.                  |
| `POST` [`/v1/messages/batches`](/api/batches)           | Async batches — up to 1,000 requests per submission, results as JSONL.              |
| `GET` [`/v1/models`](/api/models-endpoint)              | 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](/api/batches).
</Note>

### The agent-native surface

The endpoints above are one turn each. These are for work that outlives a request — a job
you submit, follow, and inspect afterwards.

| Endpoint                                                                      | What it does                                                                                           |
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `POST` [`/v1/agent-runs`](/api/agent-runs)                                    | Create a durable run. With a model and input, the gateway executes it and you follow the event stream. |
| `GET` [`/v1/agent-runs/{id}/events`](/api/agent-runs#follow-the-event-stream) | SSE tail of a run's event log.                                                                         |
| `POST` [`/v1/states`](/api/agent-runs#states)                                 | Durable, append-only state handles for an agent's working memory.                                      |
| `POST` [`/v1/artifacts`](/api/artifacts)                                      | Store a large result once, then query slices of it instead of re-reading it into the prompt.           |

### Also on the surface

| Endpoint                                                            | What it does                                  |
| ------------------------------------------------------------------- | --------------------------------------------- |
| `GET` [`/v1/responses/{id}`](/api/responses#stateful-conversations) | Replay a stored Responses envelope.           |
| `GET` `/healthz`                                                    | Unauthenticated liveness probe. Returns `ok`. |

## Conventions

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