Developer docs

Build once. Route across models.

SilkRouter exposes an OpenAI-compatible API surface for chat completions, model discovery, and usage tracking. This documentation is an early-access preview.

Quickstart

Use the same client patterns as OpenAI-compatible APIs. Replace your base URL with SilkRouter and choose a SilkRouter model route.

Request
curl https://api.silkrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $SILKROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "silk-auto",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user", "content": "Summarize this customer message."}
    ]
  }'

Authentication

Each request must include a Bearer token. Early access keys are issued manually during onboarding.

Header
Authorization: Bearer sk_live_your_key_here
Never expose API keys in browser-side code, mobile apps, public repositories, screenshots, or customer support tickets.

POST /v1/chat/completions

Send a list of messages and choose a model route. The gateway may route the request to different upstream models depending on availability, cost, and policy.

Request body

FieldTypeDescription
modelstringSilkRouter route such as silk-auto, silk-fast, silk-reasoner, or silk-coder.
messagesarrayOpenAI-style message list with role and content.
streambooleanWhen supported by the selected provider, stream partial output.
routing.prioritystringOptional: lowest_cost, balanced, quality, latency.
routing.fallbackbooleanAllow fallback when the primary route fails.

GET /v1/models

Returns the currently available model routes for your account. Early access accounts may see different model availability depending on region, provider configuration, and enterprise policy.

Response shape
{
  "object": "list",
  "data": [
    {"id": "silk-auto", "object": "model", "owned_by": "silkrouter"},
    {"id": "silk-fast", "object": "model", "owned_by": "silkrouter"},
    {"id": "silk-reasoner", "object": "model", "owned_by": "silkrouter"}
  ]
}

Error format

Every failed request returns a stable error code and request ID for support, debugging, and audit trails.

Error example
{
  "error": {
    "code": "insufficient_credit",
    "message": "Your account balance is too low to complete this request.",
    "request_id": "req_01H..."
  }
}

Production checklist

  • Store API keys only on your server.
  • Set per-user and per-organization spend caps.
  • Log the SilkRouter request ID with every customer request.
  • Use fallback routes only when your application can tolerate provider variation.
  • Contact SilkRouter for enterprise data-retention and provider restrictions.