/Docs
Back to dashboard

Quickstart

Send your first LLMsRelay API request with Anthropic-compatible or OpenAI-compatible formats.

LLMsRelay is an independently operated API gateway. It is not affiliated with or endorsed by Anthropic, PBC. Product and model names are used only to describe compatibility.

Base URL: https://api.llmsrelay.com. Endpoint: POST /v1/messages. Auth header: x-api-key: YOUR_KEY. Default model: claude-sonnet-4.6. Time to first call: ~2 minutes.

1. Get Your API Key

Sign up at llmsrelay.com and create an API key from your dashboard. Your key will look like sk-cs4-....

Validate gateway access

Before sending real requests, run two cheap checks: a health probe and a models list. They confirm the base URL, your network, and (for /v1/models) your API key — without spending any credits.

1. Liveness probe — /healthz

Public, unauthenticated. Returns 200 and a JSON status payload when the gateway is up. Use it from CI, monitoring, or any shell.

curl -sS -o /dev/null -w "HTTP %{http_code}\n" \
  https://api.llmsrelay.com/healthz

2. Auth + catalogue — /v1/models

Returns the list of model IDs you can use with the messages API. Requires a valid x-api-key. If this works, your key, base URL, and headers are all correct.

curl -sS https://api.llmsrelay.com/v1/models \
  -H "x-api-key: $ANTHROPIC_API_KEY" | jq '.data[].id'

What a healthy response looks like

  • /healthz → HTTP 200 with {"status":"ok", ...}. Anything else (timeout, 5xx, HTML page) means you hit the wrong host or there is a network/proxy issue.
  • /v1/models → HTTP 200 with {"object":"list","data":[...]}. The data array contains the only model IDs accepted by /v1/messages.

Common mistakes

  • Wrong base URL. The only correct host is https://api.llmsrelay.com. Do not use api.anthropic.com, api.llmsrelay.com (old) or any other variant.
  • Missing /v1 prefix. Endpoints live under /v1/* (e.g. /v1/messages, /v1/models). /healthz is the one exception — it is at the root.
  • Wrong auth header. Use x-api-key: sk-cs4-... (Anthropic-style). Do not send Authorization: Bearer ... unless the SDK builds it for you.
  • Invalid model ID. Only IDs returned by /v1/models work. The public catalogue includes claude-opus-5, claude-fable-5, claude-opus-4.8, claude-opus-4.7, claude-opus-4.6, claude-sonnet-5, claude-sonnet-4.6, and claude-haiku-4.5, subject to key filtering.

Tip: use /v1/models as the source of truth for model IDs in your scripts and CI — never hard-code a list.

2. Send Your First Request

Anthropic Format

cURL — Anthropic Messages APIbash
curl https://api.llmsrelay.com/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4.6",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "What is the capital of France?"}
    ]
  }'

OpenAI-Compatible Format

cURL — OpenAI Chat Completionsbash
curl https://api.llmsrelay.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4.6",
    "messages": [
      {"role": "user", "content": "What is the capital of France?"}
    ]
  }'

3. Set Up IDE Integration

Cursor

Cursor Pro Plan Required

Custom API providers only work on Cursor's paid Pro plan or higher. The pay-as-you-go starter ($5) does not support third-party API keys.

In Cursor Settings → Models → Add Provider:

  • Base URL: https://api.llmsrelay.com/v1
  • API Key: your LLMsRelay API key
  • Add a model ID returned by GET /v1/models, for example claude-sonnet-4.6

Claude Code

Claude Code CLI uses api.llmsrelay.com with sk-cs4-* keys. Use ANTHROPIC_API_KEY only — never ANTHROPIC_AUTH_TOKEN.

Linux / macOS:

Set environment variablesbash
export ANTHROPIC_BASE_URL="https://api.llmsrelay.com"
export ANTHROPIC_API_KEY="YOUR_SK_CS4_KEY"
export ANTHROPIC_MODEL="claude-sonnet-4.6"
export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4.5"

Windows PowerShell:

Set environment variables (PowerShell)powershell
$env:ANTHROPIC_BASE_URL = "https://api.llmsrelay.com"
$env:ANTHROPIC_API_KEY = "YOUR_SK_CS4_KEY"
$env:ANTHROPIC_MODEL = "claude-sonnet-4.6"
$env:ANTHROPIC_SMALL_FAST_MODEL = "claude-haiku-4.5"

Important

For Claude Code, the base URL must be set without /v1. The CLI appends /v1/messages automatically. See the dedicated Claude Code guide for the full ~/.claude/settings.json template and verification steps.

4. List Available Models

List the model IDs currently available to your key:

curl https://api.llmsrelay.com/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

5. Billing Basics

  • Choose a one-time platform usage pack. Current prices and credited usage are shown on the Plans page.
  • You are billed per token (input + output) based on the model used
  • Check your balance anytime in the dashboard
  • Purchased usage remains available until it is consumed
See Pricing for full per-model token rates.

Next Steps

Ready to start?

Create a key and configure a compatible API route in under 2 minutes.

View Plans