Agent Setup
Set up SIRAYA Model Router without a human in the loop: this page is the single contract an autonomous agent needs to go from an API key to a working configuration. If you can read one page and run shell commands, you can integrate.
Machine-readable companions: agent-setup.json (structured manifest) and llms.txt (site index).
The three variables
| Variable | Required | Meaning |
|---|---|---|
SIRAYA_API_KEY |
yes | Bearer token from the dashboard |
SIRAYA_BASE_URL |
no | Defaults to https://llm.siraya.ai/v1 |
SIRAYA_MODEL |
no | Defaults to a model you pick from /v1/models below |
Base URL: one host, two forms
SIRAYA_BASE_URL (the /v1 form) fits most tools. Anthropic-protocol tools need the root form — they append /v1/... themselves. Wrong pairing fails fast (both measured):
| Client family | Base URL | Why |
|---|---|---|
| OpenAI-protocol tools (OpenAI SDK, LiteLLM, LangChain, curl) | https://llm.siraya.ai/v1 |
these clients append only the endpoint path |
| Anthropic-protocol tools (Anthropic SDK, Claude Code) | https://llm.siraya.ai |
these clients append /v1/... themselves — giving them the /v1 form produces /v1/v1/... → 400 |
Giving an OpenAI tool the root form produces /models instead of /v1/models → 404.
Six steps
# 1. Resolve the base URL (default: the docs you are reading)
BASE="${SIRAYA_BASE_URL:-https://llm.siraya.ai/v1}"
# 2. Verify auth and discover your available models
curl -sS "$BASE/models" -H "Authorization: Bearer $SIRAYA_API_KEY" \
| python3 -c 'import json,sys; print("\n".join(m["id"] for m in json.load(sys.stdin)["data"]))'
# 3. Pick a model (model availability is scoped to your key — always
# discover the list first instead of copying an ID from examples)
MODEL="${SIRAYA_MODEL:-<an-id-from-step-2>}"
# 4. Smoke test with a hard cost cap
curl -sS "$BASE/chat/completions" \
-H "Authorization: Bearer $SIRAYA_API_KEY" \
-H 'Content-Type: application/json' \
-d "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply OK\"}],\"max_tokens\":32}"
# 5. Write the env file (mode 600 — it holds a secret)
umask 177 && cat > ./siraya.env <<EOF
SIRAYA_API_KEY=$SIRAYA_API_KEY
SIRAYA_BASE_URL=$BASE
SIRAYA_MODEL=$MODEL
EOF
# 6. Write your tool config from the snippets below, then verify
Acceptance checks
| Check | Pass condition |
|---|---|
GET /v1/models |
HTTP 200 and non-empty data |
| Chat smoke | HTTP 200 and non-empty choices |
| Responses (optional) | HTTP 200 and object == "response" |
| Embeddings (optional) | HTTP 200 and data[0].embedding is a list |
| Messages (optional) | HTTP 200 and content is non-empty |
Failure map
| Symptom | Likely cause | Action |
|---|---|---|
401 |
bad/missing key | stop; do not retry |
402 |
no credits | stop; ask the account owner |
403 |
key not allowed for model | re-discover models (step 2) |
404 / model_not_found |
stale model ID | re-discover models (step 2) |
429 |
rate limited | honour the Retry-After header |
503 / all_vendors_cooling_down |
upstream unavailable | wait, then retry once |
Tool config snippets
Every snippet is complete and non-interactive: write the file, no menus to click through. Substitute $SIRAYA_API_KEY from your env file.
OpenCode (opencode.json, placed in the project or ~/.config/opencode/)
{
"provider": {
"siraya": {
"npm": "@ai-sdk/openai-compatible",
"name": "SIRAYA Model Router",
"options": {
"baseURL": "${SIRAYA_BASE_URL}",
"apiKey": "$SIRAYA_API_KEY"
},
"models": { "$SIRAYA_MODEL": {} }
}
}
}
Tested with OpenCode 1.19.5 (config loads, opencode run -m siraya/gpt-5.4-mini answers) and 2.2.6 (audit). On the v2 providers shape, the same fields live under providers.siraya with options.apiKey unchanged.
Claude Code (~/.claude/settings.json — create the file if missing)
{
"env": {
"ANTHROPIC_BASE_URL": "https://llm.siraya.ai",
"ANTHROPIC_AUTH_TOKEN": "$SIRAYA_API_KEY",
"ANTHROPIC_MODEL": "$SIRAYA_MODEL",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}
Note the base URL is the root host without /v1. See the Claude Code guide for tier mapping.
Codex CLI (~/.codex/config.toml)
model = "$SIRAYA_MODEL"
model_provider = "siraya"
[model_providers.siraya]
name = "SIRAYA Model Router"
base_url = "${SIRAYA_BASE_URL}"
env_key = "SIRAYA_API_KEY"
wire_api = "responses"
env_key reads the key from the environment — source siraya.env in your shell profile instead of exporting per session. Tested with codex-cli 0.142.2 (audit-verified on 0.167.0).
n8n (HTTP Request node — no credential UI needed)
n8n's HTTP Request node with Generic Credential → Header Auth can be provisioned from a file; the plain equivalent needs no credential object at all:
curl -sS "$SIRAYA_BASE_URL/chat/completions" \
-H "Authorization: Bearer $SIRAYA_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"model":"'"$SIRAYA_MODEL"'","messages":[{"role":"user","content":"hi"}],"max_tokens":32}'
In n8n workflows, point an HTTP Request node at $SIRAYA_BASE_URL/chat/completions with the same headers/body. (The n8n desktop install itself is a human setup step — ~4 minutes; it exceeds an agent's patience but not a human's.)
Claude Desktop
GUI-only feature (Developer → Configure Third-Party Inference). There is no supported file-only path — human-only; agents should use Claude Code or the raw API instead. The underlying JSON fields (inferenceProvider, inferenceGatewayBaseUrl) are documented in the Claude Desktop guide field reference.