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

# API overview

> Endpoints, request limits, and the supported compatibility surface.

The API serves `derestricted-llm` through three text-generation formats. Choose the format your client already uses.

| API                     | Endpoint                         | Reference                                 |
| ----------------------- | -------------------------------- | ----------------------------------------- |
| OpenAI Chat Completions | `POST /v1/chat/completions`      | [Chat Completions](/api/chat-completions) |
| OpenAI Responses        | `POST /v1/responses`             | [Stateless Responses](/api/responses)     |
| Anthropic Messages      | `POST /v1/messages`              | [Messages](/api/messages)                 |
| Input estimate          | `POST /v1/messages/count_tokens` | [Count tokens](/api/count-tokens)         |
| Model discovery         | `GET /v1/models`                 | [Models](/api/models)                     |

All paths use `https://api.derestricted.ai`. Generation and token-estimate requests require your [API key](/authentication). SDK configuration differs: OpenAI clients use `https://api.derestricted.ai/v1`, while Anthropic clients use `https://api.derestricted.ai`.

## Compatibility scope

Chat Completions, Responses, and Messages support streaming and non-streaming text responses. Client-defined tool schemas and tool results can travel in those request formats; your application executes its own tools.

The service does not offer provider-hosted web search, file search, code execution, file storage, images, audio, video, embeddings, fine-tuning, or Assistants APIs. Legacy `POST /v1/completions` and `POST /v1/embeddings` return `404`. A compatible request shape does not make every feature of another provider available.

JSON Schema structured output is currently disabled. Requests using `response_format.type: "json_schema"`, `output_format.type: "json_schema"`, or `text.format.type: "json_schema"` are rejected. See the [OpenAI](/api/openai-compatibility) and [Anthropic](/api/anthropic-compatibility) pages for fields that are ignored.

## Current request limits

These are operational limits, not throughput guarantees. Shared model capacity and available credit also affect admission.

| Limit                                 | Current value                                        |
| ------------------------------------- | ---------------------------------------------------- |
| JSON request body                     | 4 MiB                                                |
| Messages or Responses input items     | 2,000                                                |
| Tool definitions                      | 128, with at most 1 MiB of serialized tool JSON      |
| Default output allowance when omitted | Up to 32,768 tokens, reduced to fit available credit |
| Hard output cap                       | 65,536 tokens                                        |
| Concurrent requests per account       | 4                                                    |
| Per-key request rate                  | 600 requests per minute                              |

Input admission also uses a conservative bound based on serialized request bytes and message overhead, capped at 2,000,000. This is separate from model tokenization: a request can hit the byte-based input limit before it reaches a model context limit. The [token estimate endpoint](/api/count-tokens) is approximate and does not guarantee admission.

Explicit output allowances above the hard cap are capped. If the requested allowance cannot be reserved against your balance, the API returns `402`; reducing the allowance or conversation size can help. With no explicit allowance, the service chooses an affordable value within its default.

## Streaming and accounting

Use `stream: true` for server-sent events. The service sends keepalives while waiting for model output; clients should ignore these rather than treating them as text. Closing the connection stops delivery and cancels the upstream request.

Requests reserve credit before generation so concurrent requests share the account budget safely. Final usage is accounted for after generation. A stream can fail after an initial HTTP `200`, so handle error events as well as HTTP errors. See [errors](/api/errors).
