orq.aiAdvent of RoutingDocs

Door 1 · still sealed

Hands off the wax, elf. This door opens on Dec 1.

-days--hours--min--sec

Rudolph is still polishing this one. Back to the calendar

Door 1 · Dec 1 One endpoint, one base URL

The workshop opens

Keep your OpenAI SDK, change three values, and one base URL reaches every provider while the model name picks who answers.

First morning of the season, fifteen minutes before the doors open. Sprocket's monitor has vanished under sticky notes: one API key per provider, and one more about where he left the others.

  1. Santa

    Ho ho ho, doors open! Every toy idea, past every model, by tonight.

  2. Sprocket

    On it! Five SDKs, five keys, five adapters. I've named them Dasher to Comet!

  3. Tinsel

    Keep your OpenAI client. Change three values: the base URL, the key and the model name.

  4. Sprocket

    So trying Anthropic is just... a different string?

  5. Tinsel

    anthropic/claude-haiku-5-5. Same request, same response, so Dasher to Comet can go back to the stables.

clientYour appOpenAI SDKorq.aiAI Routermy.orq.ai/v3/routerprovideropenai/gpt-6-lunaprovideranthropic/claude-haiku-5-5model=model=
  1. clientYour appOpenAI SDK
  2. orq.aiAI Routermy.orq.ai/v3/router
  3. provideropenai/gpt-6-luna
    provideranthropic/claude-haiku-5-5
Every call goes to one North Pole address, and the prefix on the model name, like the label on a parcel, tells the router which provider answers.

How it works

Tinsel’s fix is three values in a client you already have.

  1. Base URL. Point the OpenAI SDK at https://my.orq.ai/v3/router. It is the same for every organisation, workspace and project, and it does not vary by region. Self-hosted deployments serve /v3/router under their own hostname.
  2. API key. Send your Orq key as Authorization: Bearer $ORQ_API_KEY. Each key belongs to one project, and its requests are scoped to that project.
  3. Model name. Write it as provider/model, for example openai/gpt-6-luna. To switch provider, change that string.

Request bodies, response bodies and streaming stay the same. Cost per call and traces work from the first request, with no further code.

Try it with curl

curl -X POST https://my.orq.ai/v3/router/responses \
  -H "Authorization: Bearer $ORQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-4-neon",
    "input": "Name a reindeer"
  }'

Or from the OpenAI SDK

The same prompt on two providers, from one client:

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://my.orq.ai/v3/router",
    api_key=os.environ["ORQ_API_KEY"],
)

models = ["openai/gpt-6-luna", "anthropic/claude-haiku-5-5"]
for model in models:
    response = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": "Name a reindeer"}],
    )
    print(model, "->", response.choices[0].message.content)

Save it as two_models.py and run it with uv run --with openai python two_models.py. In Node the option is spelled baseURL, not base_url.

What the base URL serves

Most OpenAI routes work under /v3/router unchanged:

Route What for
POST /chat/completions Chat
POST /responses Responses API
POST /embeddings Embeddings
GET /models Model catalogue
/batches Batch jobs. Download results from GET /batches/{batch_id}/results, not the OpenAI files endpoint

Orq adds its own routes on the same URL, such as POST /rerank, POST /decisions and POST /ocr. Use /v3/router for new work. The older /v2/router/ paths stay published for backward compatibility.

Before the first call

Every model you call must be enabled on the Models page in the AI Gateway. The workspace also needs Orq credits or your own provider key. A call fails while it has neither.

When a call fails

A 404 means the model name is wrong. A 403 with permission_error means the model is not enabled. fallbacks does not help here, because the model is resolved before routing runs.

The Assistants API and fine-tuning are not available. /assistants and /fine_tuning/jobs return 404, so apps built on them cannot move over as they are.

Sending tools to /chat/completions with an OpenAI reasoning model and a reasoning_effort other than none returns 400. Use /responses for that case.

Nice list

  • Enable every model your app calls on the Models page, not just the one you used for the first request.
  • Check each model id against GET /v3/router/models. A punctuation difference or a date suffix makes it a different model.
  • Leave Permissions on All for your first key. A Read only key, or a Restricted key without Responses write access, gets a 403 on /v3/router/responses.

Naughty list

  • Hunting for a regional or per-workspace base URL. https://my.orq.ai/v3/router is the same for every organisation, workspace and project, and it does not vary by region.
  • Pointing new code at /v2/router/. Those paths stay only for backward compatibility. /v3/router is the current surface.
  • Pointing an Anthropic client at /v3/router. Anthropic SDK code belongs on https://my.orq.ai/v3/anthropic.
  • Moving an app built on the Assistants API or fine-tuning. /assistants and /fine_tuning/jobs return 404.

Elf's challenge

Pick a model from a provider you have never called, from GET /v3/router/models, and add it to your loop. How many lines of your code changed?

Stuck? Ask Tinsel for a hint

One: the model string. A 403 with permission_error means you still have to enable the model on the Models page. A 404 means the name is misspelled.

Christmas crackerHow many keys does it take to open an advent calendar?Pull it for the punchline

One. The model name picks which door opens.