Skip to main content

Routing

Routing is how NuRoute chooses which AI model and provider answer each request. client.routing lets you see and change how that works.

The short version: Artemis decides every model: 'auto' request, based on what each model is good at. A request that names a model uses no router. To learn how Artemis thinks, read How Artemis decides.

The router​

There is no router for you to choose, neither per request nor in a setting.

  • The chat call's router option (RouterChoice) is optional. It accepts only 'artemis' or 'v2', and both change nothing. Any other value is rejected with a NuRouteError whose status is 400.
  • When Artemis cannot decide a request, the fallback router decides it. The request's routerVersion and routerFallback say so, and why (see Which router decided).
  • Your region restrictions apply either way.

More in Routing concepts.

Artemis options​

An option is your choice between cheaper and better. Send it as the model: 'artemis-cost', 'artemis-balanced' or 'artemis-quality'. 'auto' is 'artemis-balanced'. All three cost the same per token. They differ in how much extra cost is worth a better expected answer (Artemis options).

const res = await client.chat.complete({
model: 'artemis-cost',
messages: [{ role: 'user', content: 'Extract the invoice number: ...' }],
});
res.model; // the model Artemis picked

If your organization may not use an option, the request is refused with a NuRouteError whose status is 400 and whose message names the options it may use. On NuRoute Cloud, Quality is available on request. GET /v1/artemis-options lists yours.

Region restrictions​

A region is a part of the world where a provider runs. Your organization's allowed regions and its fallbackBehavior live in the routing config.

updateConfig() replaces everything

It replaces the whole config. So read it first, change only what you need, and send all of it back.

Changing the config needs an owner's or admin's session. Sign the client in with auth.login() (see Authentication). With an API key, getConfig() works, but updateConfig() fails with 403.

const config = await client.routing.getConfig();
await client.routing.updateConfig({
...config,
allowedRegions: ['EU'],
policy: { ...config.policy, fallbackBehavior: 'fail' }, // EU is a hard limit
});
  • See Region restrictions for how regions match.
  • See Fallback for what fallbackBehavior controls. It decides what happens when no provider is in your regions. It is not about whether the gateway retries when a provider errors.

Routing history​

Look back at how recent requests were routed:

const { decisions, total } = await client.routing.listHistory({
limit: 20,
offset: 0,
provider: 'openai', // optional filter
status: 'success', // optional filter
});

const detail = await client.routing.getDecision(decisions[0].id);
console.log(detail.selectedProvider, detail.routerVersion, detail.candidates);

Which router decided​

client.chat.complete() returns the response body only. So to find the router, read the request log. The completion id is chatcmpl- followed by the request id, and client.requests.list() can search for it:

const res = await client.chat.complete({ model: 'auto', messages });

const requestId = res.id.replace(/^chatcmpl-/, '');
const { requests } = await client.requests.list({ search: requestId, limit: 1 });
const detail = await client.requests.get(requests[0].id);

console.log(detail.routerVersion, detail.capabilityVersion, detail.routerFallback);
// 'v2' 'cap-6' null, or 'v1' null 'no_estimates' when the fallback router decided

RequestDetail (from client.requests.get()) and RoutingDecision (from client.routing.getDecision()) both extend RouterDecision:

FieldTypeMeaning
routerVersionRouterVersion | nullThe router that decided: 'v2' (Artemis) or 'v1' (the fallback router). null for a request that named a model
capabilityVersionstring | nullThe capability version Artemis decided with, e.g. 'cap-6'. null when the fallback router decided
routerFallbackstring | nullWhy the fallback router decided instead of Artemis. null otherwise

RequestDetail also splits up the request's time:

FieldMeaning
latencyMsThe provider call
routingDurationMsRouting
totalMsEnd to end, as the gateway measured it (0 for requests recorded before it was tracked)
overheadMsThe rest (null when totalMs is 0)

There is no separate timeline call: requests.getTimeline() was removed, because the gateway has no such endpoint.

Why the fallback router decided​

When the fallback router decides, the request is still served, and your region restrictions apply to its choice too. Here are the reasons:

routerFallbackMeaning
estimate_busyArtemis had no estimates: router-model was busy with other requests
estimate_timeoutArtemis had no estimates: they did not arrive in time
estimate_unavailableArtemis had no estimates: router-model was unreachable or had no capability version loaded
no_estimatesArtemis had no estimates for another reason (before 2026-10-23, for any of the reasons above too)
unknown_capability_versionArtemis's estimates came from a capability version the deployment does not know
manual_modeThe request pins a provider
preset_unavailableThe capability version has no preset for the option
no_servable_modelNone of Artemis's models could be served after your region restrictions and the enabled providers
v2_disabledArtemis is switched off by the operator. Self-hosted NuRoute does not include Artemis yet, so its auto requests all report this
invalid_estimatesArtemis's estimates failed a sanity check
v2_errorArtemis hit an error while deciding

Candidates​

candidates lists what was weighed. Each one has provider, model, costUsd, latencyMs, score (0–100) and winner.

On an Artemis decision, each Candidate adds Artemis's own figures. There is one row for each pool model that can be served, on the provider that would serve it.

FieldTypeMeaning
qualitynumberThe model's expected score on this prompt (0–1)
utilitynumberThe expected score minus the option's price for extra cost. The highest wins
inputTokensnumberThe prompt tokens it priced
outputTokensnumberThe answer length, in tokens, it expected
expectedLatencyMsnumberThe answer time it expected on this provider

When the fallback router decided, candidates lists the models it weighed in its tier. score is each one's rank (the winner highest), and the fields above are absent.