Four days to go, and a sack of European letters thumps onto Santa's desk with a note pinned on top: read in Europe, please.
- Santa
The European parents have a new rule: every letter read in Europe, starting tonight!
- Mrs. Claus
Our archive already lives in the EU. But who reads each letter, and where does that model run?
- Tinsel
Right now? Whatever model the app asked for, wherever that model runs.
- Santa
Then every app elf rewrites every model name by midnight. Chop chop!
- Tinsel
No rewrites. Stamp each letter
region: eu, and one rule on the workshop wall swaps in EU-hosted models.
- clientYour appmetadata.region
- orq.aiRouting rulemetadata.region == "eu"
- 1match2fallbackno matcheu-hostedEU GPT-6.2 Solopenai/eu.gpt-6.2-soleu fallbackEU Gemini 4 Neongoogle/eu.gemini-4-neonpayload modelPayload modelclaude-sonnet-5-5
How it works
Tinsel’s fix is one rule on the workshop wall. A routing rule is a CEL condition that the AI Router checks on every request. When it matches, the router sends the request to the rule’s models instead of the one in the payload. No model name changes in your apps.
- Match. Every enabled rule whose
expression.celmatches the request is a candidate. The condition can readmodel,model_id,provider,headers,metadata,identity,projectandapi_key. - Pick a winner. Workspace-wide rules outrank project-scoped ones. Within the winning scope, the lowest
prioritywins, and the oldest rule breaks a tie. - Replace. The winning rule’s
models_configreplaces the request’s ownmodel,load_balancer,fallbacksandfallback_on_codes. They are never merged. A request that matches no rule keeps its own model.
Try it with curl
You need a Management Key with Write access to the Routing rules capability. Rules are visible to workspace administrators only.
curl -X POST https://my.orq.ai/v2/routing-rules \
-H "Authorization: Bearer $ORQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"display_name": "eu-letters",
"priority": 0,
"expression": { "cel": "metadata.region == \"eu\"" },
"models_config": {
"mode": "fallback",
"models": [
{ "model": "openai/eu.gpt-6.2-sol" },
{ "model": "google/eu.gemini-4-neon" }
]
}
}'
From the terminal, orq routing-rules create takes the same fields as flags: --display-name, --enabled, --priority, --expression and --models-config.
display_name is the only required field. enabled defaults to false, so the rule above is saved disabled and matches nothing yet. Check it with orq routing-rules list, then switch it on with orq routing-rules update <rule-id> --enabled.
Or from the OpenAI SDK
Your app keeps its usual model and adds one tag. With the OpenAI SDK, pass metadata in extra_body:
from openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["ORQ_API_KEY"],
base_url="https://my.orq.ai/v3/router",
)
# The rule replaces this model when the tag matches.
response = client.responses.create(
model="anthropic/claude-sonnet-5-5",
input="Dear Santa, I would like a sledge.",
extra_body={"metadata": {"region": "eu"}},
)
print(response.output_text)
metadata values must be strings. On the Responses API, other types get a 400.
What stays in the EU
On the orq.ai-hosted platform, your platform data stays in the EU by default, with no setup: traces, logs, datasets, prompts, evaluations and workspace configuration. There is no US region.
Model calls are different. They go to the provider of the model you choose. To keep inference in the EU, pick models that run there. The model catalog lists each model’s location, for example:
| Model | Location |
|---|---|
openai/eu.gpt-6.2-sol |
EU |
google/eu.gemini-4-neon |
EU |
aws/eu.anthropic.claude-sonnet-5-5 |
EU |
anthropic/claude-sonnet-5-5 |
global |
Gotchas
Fallbacks count too. In fallback mode the router moves down the rule’s models list. Keep every entry EU-located, or a fallback sends the request out of the EU.
A tag is opt-in. The caller sets metadata, so a caller can leave it out. When every request in a project must stay in the EU, put a project condition in a workspace-wide rule instead.
Scope is fixed. Omit project_id for a workspace-wide rule. A rule keeps the scope it was created in.
Nice list
- Pick models the catalog marks as EU, such as
openai/eu.gpt-6.2-soloraws/eu.anthropic.claude-sonnet-5-5. - Create the rule without
enabled, check it withorq routing-rules list, then switch it on. - Send
metadatavalues as strings. The Responses API rejects non-string values with a400. - When every request in a project must stay in the EU, put a
projectcondition in a workspace-wide rule. A project-scoped rule loses to any matching workspace-wide rule.
Naughty list
- Trusting a
metadatatag to enforce residency. The caller sets it, so a letter sent without the tag matches no rule and keeps the model in its payload, which may be global. - Sending your own
fallbacksand expecting them to survive. A matching rule's models replace the request'smodel,load_balancer,fallbacksandfallback_on_codes. - Writing a rule to keep traces and logs in the EU. On the orq.ai-hosted platform they already stay there; rules only move model calls.
Elf's challenge
Two rules both match the same EU-tagged letter: a project-scoped one with priority 0 and a workspace-wide one with priority 10. Which rule picks the model?
Stuck? Ask Tinsel for a hint
The workspace-wide one: scope is checked before priority. Priority only settles ties inside the winning scope, and the oldest rule breaks a tie there.
Christmas crackerWhat do you call a routing rule nobody switched on?Pull it for the punchline
A silent night. A rule created without enabled starts switched off.