Get started
Markdown ↗

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.

Start building

At a glance

SettingZrelay
API hosthttps://api.zrelay.net
OpenAI SDK base URLhttps://api.zrelay.net/v1
Anthropic SDK base URLhttps://api.zrelay.net
AuthenticationAuthorization: Bearer or x-api-key
BillingPrepaid USD balance; charges depend on model, endpoint and pool
AccountKeys, spending controls and usage

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

MethodPathPurpose
POST/v1/chat/completionsOpenAI-compatible text and tool requests
POST/v1/responsesGPT Responses requests
POST/v1/messagesAnthropic-compatible Messages
POST/v1/images/generationsImage generation on an enabled route
GET/v1/modelsModels accessible to your key
GET/v1/usageShared account balance and usage
POST/v1/requestsPaginated 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.

bash
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 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 →

Claude

Use /v1/messages with an Anthropic-compatible client. Messages examples and compatibility →

GPT

Use /v1/responses or /v1/chat/completions when the route is listed for your pool. Responses reference →

Grok

Use /v1/chat/completions with an enabled Grok model from the catalog and a matching key. Chat Completions reference →

Images

Image routes have their own request prices and pool availability. Generate images →

Streaming

Receive incremental output using the event format of your chosen endpoint. Streaming guide →

Errors

Check HTTP status, the error body and the x-zrelay-request-id response header. Error reference →

Balance and usage

Read your account balance with GET /v1/usage. Balance and billing reference →

Request history

Use POST /v1/requests for your key’s request history, or open Usage in your account portal. Request history and pagination →

Questions about your integration? support@zrelay.net