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.
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.
Authorization: Bearer sk_live_your_key_here
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
| Field | Type | Description |
|---|---|---|
| model | string | SilkRouter route such as silk-auto, silk-fast, silk-reasoner, or silk-coder. |
| messages | array | OpenAI-style message list with role and content. |
| stream | boolean | When supported by the selected provider, stream partial output. |
| routing.priority | string | Optional: lowest_cost, balanced, quality, latency. |
| routing.fallback | boolean | Allow 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.
{
"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": {
"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.