Each Zrelay key is for one provider and uses that provider's request structure. Claude, GPT, and Grok share api.zrelay.net, but their headers, paths, and JSON payloads differ. Pick a provider below.
The Zrelay key you receive starts with zr_live_ and is created for one provider. Use that provider's native request format; the required header depends on the wire format.
All traffic goes through api.zrelay.net. Zrelay routes by path to the right upstream, while each provider keeps its own wire format. A key works only with the provider it was created for.
Point any Anthropic SDK at Zrelay with the base URL below. The SDK appends /v1/messages for you. Application installation and configuration live in Setup.
curl https://api.zrelay.net/v1/messages \ -H "x-api-key: zr_live_..." \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-opus-5", "max_tokens": 1024, "messages": [ {"role": "user", "content": "Explain Zrelay in one line."} ] }'
from anthropic import Anthropic client = Anthropic( base_url="https://api.zrelay.net", # no /v1 api_key="zr_live_...", ) msg = client.messages.create( model="claude-opus-5", max_tokens=1024, messages=[{"role": "user", "content": "Hello"}], ) print(msg.content[0].text)
Use the OpenAI-compatible API with a base URL that includes /v1. GPT supports both responses and chat_completions. Codex installation and configuration live in Setup.
curl https://api.zrelay.net/v1/chat/completions \ -H "Authorization: Bearer zr_live_..." \ -H "content-type: application/json" \ -d '{ "model": "gpt-5.6-sol", "messages": [ {"role": "user", "content": "Explain Zrelay in one line."} ] }'
curl https://api.zrelay.net/v1/responses \ -H "Authorization: Bearer zr_live_..." \ -H "content-type: application/json" \ -d '{ "model": "gpt-5.6-terra", "input": "Refactor this function for readability." }'
from openai import OpenAI client = OpenAI( base_url="https://api.zrelay.net/v1", # include /v1 api_key="zr_live_...", ) resp = client.chat.completions.create( model="gpt-5.6-sol", messages=[{"role": "user", "content": "Hello"}], ) print(resp.choices[0].message.content)
Grok exposes only the OpenAI-compatible Chat Completions format. Set the base URL with /v1 and select chat_completions as the backend.
curl https://api.zrelay.net/v1/chat/completions \ -H "Authorization: Bearer zr_live_..." \ -H "content-type: application/json" \ -d '{ "model": "grok-6", "messages": [ {"role": "user", "content": "What just happened in the world?"} ] }'
from openai import OpenAI client = OpenAI( base_url="https://api.zrelay.net/v1", # include /v1 api_key="zr_live_...", ) resp = client.chat.completions.create( model="grok-6", messages=[{"role": "user", "content": "Hello"}], ) print(resp.choices[0].message.content)
Every key carries its own meter. One call to /v1/usage returns what you've spent, your quota, what's left, and the per-model breakdown — authenticated with the same key you send traffic with.
# your key must be exported first (see the Setup guide) curl -s https://api.zrelay.net/v1/usage \ -H "x-api-key: $ZRELAY_API_KEY" | python3 -m json.tool
No python3? Drop the pipe and it prints raw JSON.
The response carries your name, spent, spent_last_24h_usd, quota and remaining in USD, plus a per-model breakdown of requests, tokens, and cost. The 24-hour value is a rolling window and requests_last_24h gives its request count. A null quota means unlimited.
Install the native CLI tools against your key, or jump straight to pricing and pick a tier.