# Zrelay API documentation

Connect the tools you already use to Claude, GPT, Grok and more. Choose a model and pool, keep the native API format, and manage your keys from one account.

Source: https://zrelay.net/docs/

## Start building

[Quickstart](https://zrelay.net/docs/md/quickstart.md) — Create a key and send your first request.

[Models](https://zrelay.net/docs/md/models.md) — Find the right model, pool and endpoint.

[Agents](https://zrelay.net/docs/md/agents.md) — Connect your coding agent or build a tool loop.

[Tool calling](https://zrelay.net/docs/md/capabilities/tool-calling.md) — Turn model suggestions into controlled actions.

[Security review](https://zrelay.net/docs/md/security-review.md) — A bounded workflow for reviewing your own code.

[API reference](https://zrelay.net/docs/md/api/chat-completions.md) — Headers, request bodies and response formats.

## At a glance

| Setting | Zrelay |
| --- | --- |
| API host | `https://api.zrelay.net` |
| OpenAI SDK base URL | `https://api.zrelay.net/v1` |
| Anthropic SDK base URL | `https://api.zrelay.net` |
| Authentication | `Authorization: Bearer` or `x-api-key` |
| Billing | Prepaid USD balance; charges depend on model, endpoint and pool |
| Account | [Keys, spending controls and usage](https://keys.zrelay.net/portal) |

## How Zrelay works

Zrelay authenticates your key and routes your request using its provider, selected pool and model. Flex and Prime keys serve one model family; each Xtra key serves the models in its selected pool.

All keys share your account balance. Pools have different rates and availability. Use the live catalog as the source for enabled routes and prices; a familiar model name alone does not guarantee access in every pool.

## Endpoints

| Method | Path | Purpose |
| --- | --- | --- |
| POST | [/v1/chat/completions](https://zrelay.net/docs/md/api/chat-completions.md) | OpenAI-compatible text and tool requests |
| POST | [/v1/responses](https://zrelay.net/docs/md/api/responses.md) | GPT Responses requests |
| POST | [/v1/messages](https://zrelay.net/docs/md/api/compatibility.md) | Anthropic-compatible Messages |
| POST | [/v1/images/generations](https://zrelay.net/docs/md/capabilities/images.md) | Image generation on an enabled route |
| GET | [/v1/models](https://zrelay.net/docs/md/api/models.md) | Models accessible to your key |
| GET | [/v1/usage](https://zrelay.net/docs/md/api/credits.md) | Shared account balance and usage |
| POST | [/v1/requests](https://zrelay.net/docs/md/api/credits.md) | Paginated request history for your key |

## Your first request

Create an account, save your account code, set up TOTP or a passkey, then create a key for an available provider and pool.

```
curl https://api.zrelay.net/v1/chat/completions \
  -H "Authorization: Bearer $ZRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.1-sol","messages":[{"role":"user","content":"Hello from Zrelay"}],"max_tokens":256}'
```

Follow the [complete quickstart](https://zrelay.net/docs/md/quickstart.md) for key setup and response handling.

## Authentication

Keep your `zr_live_` key on your server. Use Bearer authentication for OpenAI-compatible requests and `x-api-key` for Messages. [Read the authentication reference →](https://zrelay.net/docs/md/api/authentication.md)

## Claude

Use `/v1/messages` with an Anthropic-compatible client. [Messages examples and compatibility →](https://zrelay.net/docs/md/api/compatibility.md)

## GPT

Use `/v1/responses` or `/v1/chat/completions` when the route is listed for your pool. [Responses reference →](https://zrelay.net/docs/md/api/responses.md)

## Grok

Use `/v1/chat/completions` with an enabled Grok model from the catalog and a matching key. [Chat Completions reference →](https://zrelay.net/docs/md/api/chat-completions.md)

## Images

Image routes have their own request prices and pool availability. [Generate images →](https://zrelay.net/docs/md/capabilities/images.md)

## Streaming

Receive incremental output using the event format of your chosen endpoint. [Streaming guide →](https://zrelay.net/docs/md/capabilities/streaming.md)

## Errors

Check HTTP status, the error body and the `x-zrelay-request-id` response header. [Error reference →](https://zrelay.net/docs/md/api/errors.md)

## Balance and usage

Read your account balance with `GET /v1/usage`. [Balance and billing reference →](https://zrelay.net/docs/md/api/credits.md)

## Request history

Use `POST /v1/requests` for your key’s request history, or open Usage in your account portal. [Request history and pagination →](https://zrelay.net/docs/md/api/credits.md)
