Skip to main content

Quickstart

Deploy Drawbridge Gateway in 5 minutes.

Prerequisites

  • Go 1.25+ installed
  • Docker + Docker Compose (for PostgreSQL + Redis)
  • At least one AI account API key

Step 1: Start Infrastructure

Launch PostgreSQL and Redis (ValKey) for state management.

Terminal
git clone <repo-url> drawbridge
cd drawbridge
make up   # Starts postgres + valkey via Docker Compose

Step 2: Configure

Create your configuration file with at least one account.

config.yaml
server:
  port: 8080

database:
  url: "postgres://drawbridge:drawbridge@localhost:5432/drawbridge?sslmode=disable"

accounts:
  - id: "my-account"
    pool_size: 2
    tier: "pro"
    env:
      API_KEY: "your-api-key-here"

admin:
  auth_token: "your-admin-token"   # For /admin/* endpoints

Step 3: Build & Run

Terminal
make build
./bin/drawbridge --config config.yaml

Gateway is now running at http://localhost:8080

Step 4: Create an API Key

Terminal
curl -X POST http://localhost:8080/admin/keys \
  -H "Authorization: Bearer your-admin-token" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-first-key", "rate_limit": 60}'

# Response: {"key": "db-xxxx...", "name": "my-first-key"}

Step 5: Send Your First Request

Terminal
curl http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer db-xxxx..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kiro",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

Using with OpenAI SDK

Point any OpenAI SDK at your gateway. Zero code changes beyond the base URL.

Python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8080/v1",
    api_key="db-xxxx..."
)

response = client.chat.completions.create(
    model="kiro",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Deployment Options

Docker Compose (Recommended for Production)

Full stack with monitoring: gateway + PostgreSQL + Redis + Prometheus + Grafana.

make up-monitoring

Multi-Node Cluster

2+ nodes behind nginx load balancer with shared PostgreSQL + Redis.

make prepare-docker && make up-multi

Next Steps