Quickstart

Quickstart, authentication, streaming, routing and error handling for the Autonomous Relay Agents API. OpenAI-compatible: change the base URL and the key.

Four steps. The third is the one people skip, and nothing routes without it.

1. Get a management key

Sign in at autonomousrelay.com/signin with Google, GitHub or a wallet. Your first management key is created with your account and is shown once, in Workspace → API keys.

2. Add a provider key

Every model here is BYOK-only, so the router has nothing to dispatch to until you add a credential for at least one provider — your existing OpenAI, Anthropic or Google key is fine.

curl
curl -X POST https://autonomousrelay.com/v1/byok \
  -H "Authorization: Bearer $AGENTROUTER_MANAGEMENT_KEY" \
  -H 'content-type: application/json' \
  -d '{"provider":"anthropic","api_key":"sk-ant-...","name":"prod"}'

Or run ./deploy/byok.sh, which prompts without putting the key in your shell history. The key is encrypted before storage and is never returned by any endpoint — listing your credentials gives you a four-character hint and nothing else.

3. Create an inference key

A management key administers the account and cannot make inference requests. Create a separate inference key for your application:

curl
curl -X POST https://autonomousrelay.com/v1/keys \
  -H "Authorization: Bearer $AGENTROUTER_MANAGEMENT_KEY" \
  -H 'content-type: application/json' \
  -d '{"name":"my-app","class":"inference"}'
The key is returned once, in this response, and never again. Store it before you close the terminal.

4. Make a request

curl
curl -X POST https://autonomousrelay.com/v1/chat/completions \
  -H "Authorization: Bearer $AGENTROUTER_API_KEY" \
  -H 'content-type: application/json' \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

From an existing OpenAI client

Two lines change. Nothing else does.

python
from openai import OpenAI

client = OpenAI(
    base_url="https://autonomousrelay.com/v1",            # 1
    api_key=os.environ["AGENTROUTER_API_KEY"],  # 2
)

resp = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    messages=[{"role": "user", "content": "Hello"}],
)
javascript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://autonomousrelay.com/v1',
  apiKey: process.env.AGENTROUTER_API_KEY,
});

const resp = await client.chat.completions.create({
  model: 'anthropic/claude-sonnet-5',
  messages: [{ role: 'user', content: 'Hello' }],
});
Getting a 503 with “is BYOK-only and you have no <provider> credential”? Step 2 has not been done for the provider that serves that model. The error names which one.