HomeDocsagents/dsh
Gateway Protocol v1 · Production Reference

Documentation

One key, two compatible wire protocols, 15 frontier models. Read the quickstart or explore the API reference.

Introduction

Selora is a single gateway in front of a well-known family of frontier and open-weights models. One API key, one billing surface, and two compatible wire formats let you call models from Anthropic, OpenAI and Moonshot without wiring up separate SDKs or juggling a stack of credentials.

Every request you make is routed through our shared gateway, metered against your wallet, and recorded in the Usage and Logs pages. There are two base URLs — one per protocol — and they are not interchangeable, so copy the one that matches the client you are configuring.

Anthropic Wire Protocol

Anthropic

Base URL

https://api.selora.lol
SDK automatically appends /v1/messagesAuthenticate via x-api-key: sk-gw-...

OpenAI Wire Protocol

OpenAI

Base URL

https://api.selora.lol/v1
SDK automatically appends /chat/completionsAuthenticate via Authorization: Bearer sk-gw-...

Protocol Header Resolution: The gateway inspects x-api-key first and falls back to Authorization: Bearer. Both wire formats accept standard sk-gw-... gateway keys. Notice that the Anthropic URL is the bare origin (because official Anthropic SDKs append /v1/messages), while OpenAI tooling takes .../v1 (because OpenAI SDKs append /chat/completions).

The shape of an OpenAI-compatible call
bash
curl https://api.selora.lol/v1/chat/completions \
  -H "Authorization: Bearer $SELORA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "claude-sonnet-5", "messages": [{ "role": "user", "content": "Hello" }] }'

Both protocols take JSON and return JSON: an OpenAI-shaped chat completion, or an Anthropic-shaped message. Everything else — usage, billing, models — wraps the same conventions, with a 30 second cap on any single model response.

Reading a 200 response
json
{
  "id": "chatcmpl_9Qx3v2LkP",
  "model": "claude-sonnet-5",
  "choices": [{ "message": { "role": "assistant", "content": "Hello from the gateway." } }],
  "usage": { "prompt_tokens": 24, "completion_tokens": 61, "total_tokens": 85 }
}

Setup configs

Copy-paste client setup for both flavours, using the official SDKs. Replace sk-gw-... with a key from the API Keys page — the token you log into the console with is not accepted on these routes.

Anthropic-compatible · /v1/messages

Python — pip install anthropic
python
from anthropic import Anthropic

client = Anthropic(
    api_key="sk-gw-...",               # sent as x-api-key
    base_url="https://api.selora.lol",      # the origin — no /v1, the SDK appends /v1/messages
)

message = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=512,                    # required — omit it and the gateway returns 400
    messages=[{"role": "user", "content": "Say hello in one line."}],
)
print(message.content[0].text)
curl — POST /v1/messages
bash
curl https://api.selora.lol/v1/messages \
  -H "x-api-key: sk-gw-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 512,
    "messages": [{ "role": "user", "content": "Say hello in one line." }]
  }'

OpenAI-compatible · /v1/chat/completions

Python — pip install openai
python
from openai import OpenAI

client = OpenAI(
    api_key="sk-gw-...",               # sent as Authorization: Bearer
    base_url="https://api.selora.lol/v1",    # origin + /v1 — the SDK appends /chat/completions
)

completion = client.chat.completions.create(
    model="kimi-k3",
    messages=[{"role": "user", "content": "Say hello in one line."}],
)
print(completion.choices[0].message.content)
curl — POST /v1/chat/completions
bash
curl https://api.selora.lol/v1/chat/completions \
  -H "Authorization: Bearer sk-gw-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k3",
    "messages": [{ "role": "user", "content": "Say hello in one line." }]
  }'

Claude Code and other Anthropic-env agents

.claude/settings.json
json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.selora.lol",
    "ANTHROPIC_AUTH_TOKEN": "sk-gw-..."
  }
}

The same two values work as shell exports — export ANTHROPIC_BASE_URL=… and export ANTHROPIC_AUTH_TOKEN=sk-gw-…. Note the base URL is the origin again: no /v1. Per-harness walkthroughs live under Coding agents in the sidebar.