Orqen Docs

Examples

Multi-provider routing

Connect multiple providers, then use orqen/auto,orqen/cheap, or orqen/fastto let Orqen choose per request.

1. Connect providers

curl https://api.orqen.app/v1/account/providers \
  -X PUT \
  -H "Authorization: Bearer sk-orq-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider": "openai", "api_key": "sk-proj-..."}'

2. Use routing model strings

from openai import OpenAI

client = OpenAI(
    api_key="sk-orq-YOUR_KEY",
    base_url="https://api.orqen.app/v1",
)

# Orqen picks from enabled OpenAI, Anthropic, Bedrock, and other connected providers.
response = client.chat.completions.create(
    model="orqen/auto",
    messages=[{"role": "user", "content": "Analyse this error log and suggest a fix"}],
    tools=[...],
)

# Cost-sensitive background job
cheap = client.chat.completions.create(
    model="orqen/cheap",
    messages=[{"role": "user", "content": "Classify this ticket"}],
)

# Latency-sensitive chat turn
fast = client.chat.completions.create(
    model="orqen/fast",
    messages=[{"role": "user", "content": "Rewrite this sentence"}],
)

3. Enable or disable models

The dashboard Routing page lets you toggle models per provider. Disabled models are excluded from routing strings but remain available if your agent names them directly.

curl https://api.orqen.app/v1/account/routing/models/toggle \
  -X POST \
  -H "Authorization: Bearer sk-orq-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "openai",
    "model_id": "gpt-4o",
    "is_enabled": true
  }'

4. Read performance data

curl https://api.orqen.app/v1/account/routing/insights \
  -H "Authorization: Bearer sk-orq-YOUR_KEY"

Recommended rollout

Start with orqen/auto on non-critical traffic, inspect model recall and latency, then disable models that are too slow or too inaccurate for your workload.