Skip to documentation

Self-hosted

Self-hosted

Install AnchorShell Relay, find your local keys, and send a request from your own machine.

Install and start

You need Git, Make, Go 1.26.4 or a newer Go 1.26 patch, and Node.js 22.19.0 with npm.

Build from source

git clone https://github.com/anchorshell/relay.git anchorshell-relay
cd anchorshell-relay
make deps
make build
./bin/relay

Or run make run after make deps; it builds the dashboard and starts Relay.

For development with hot reload:

make install-dev-tools
make dev

The development dashboard uses http://localhost:3030. The API uses http://localhost:11730. There is no supported NPX installer in the current source.

Open the dashboard

  1. Open http://localhost:11730 after starting the built app.
  2. Enter the generated management token.
  3. Open Setup.
  4. Add your provider, credential, and model.
  5. Add a group if needed.
  6. Open Playground and enter your inference token to send a test request.

For the guided flow, use Setup.

Local configuration

First startup creates .env and prints newly generated keys once.

SettingPurpose
RELAY_API_TOKENAuthenticates inference requests
RELAY_ADMIN_TOKENUnlocks the dashboard and management API
RELAY_MASTER_KEYProtects saved provider credentials

Relay stores local configuration and usage data in relay.db. Keep the database and master key backed up together. Do not share or commit .env.

Set RELAY_HTTP_ADDR=127.0.0.1:11730 to listen only on your machine. The default listens on all interfaces. Use HTTPS and network access controls for remote access. An explicitly empty RELAY_API_TOKEN= disables inference authentication; do not use that on a public deployment.

Send a request

Replace the token placeholder with your inference token and use a Group you configured:

curl -X POST 'http://localhost:11730/v1/chat/completions' \
  -H 'Authorization: Bearer <RELAY_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "agentic",
  "messages": [
    {
      "role": "user",
      "content": "Hello"
    }
  ]
}'

Response — 200 OK

Example non-streaming response (selected fields). Content, model, and usage depend on the selected provider.

{
  "id": "<COMPLETION_ID>",
  "object": "chat.completion",
  "model": "gpt-5-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Relay waits for the preferred model before considering fallback."
      },
      "finish_reason": "stop"
    }
  ]
}

For a direct model, use its provider/model call name instead.

Management API

curl 'http://localhost:11730/api/providers' \
  -H 'Authorization: Bearer <RELAY_ADMIN_TOKEN>'

Response — 200 OK

Selected response fields shown; IDs and values are illustrative.

[
  {
    "id": "<PROVIDER_ID>",
    "name": "OpenAI",
    "slug": "openai",
    "base_url": "https://api.openai.com/v1",
    "auth_mode": "bearer_static",
    "enabled": true
  }
]

The management and inference tokens are separate. See API authentication for using the feature examples locally.

Next

API.