Routing / Policy control

Route requests by policy

Change model choice, cost, and backup models without redeploying application code.

Routing result
Example
  1. 01Request modelauto
  2. 02Team policyauto:balancedFrom API key
  3. 03Selected modelclaude-sonnet
  4. 04ReasonQuality target met within the $0.020 budget.
  5. 05Backup modelReadyNot used
  6. 06Tracereq_8f3k2m9x1p
Console policy

Set team routing policies

Saved changes apply to model "auto" on the next request.

Policy console
Example
Team defaultauto:balanced

Applies to every API key that has no strategy of its own.

Saved
Model previewclaude-sonnet

Actual selection depends on the live catalog, prices and quality scores.

Exception rule
Tools included · translation · high complexity

All conditions must match; exceptions precede team defaults. The support example below does not match.

claude-opus
Example / Request walkthrough

Follow a routing decision

01Request

Summarize a support incident log.

HTTP / JSON
POST /v1/chat/completions
X-LineMod-Budget-Max: 0.020
X-LineMod-Tag: support

{
  "model": "auto",
  "messages": [ … ]
}

02Decision

  1. 01
    Exceptions checked

    No rule matched.

  2. 02
    Team policy applied

    auto:balanced · From the API key.

  3. 03
    Model selected

    claude-sonnet · Within the $0.020 budget.

  4. 04
    Backup model prepared

    gpt-4o-mini · Not used.

03Record

Selected model
claude-sonnet
Team policy
auto:balanced
Reason
Quality target met within budget
Trace
req_8f3k2m9x1p
Status
Recorded
OpenAI-compatible API

Connect your existing workflow

JavaScript
const client = new OpenAI({
  baseURL: "https://api.linemod.ai/v1",
  apiKey: process.env.LINEMOD_API_KEY,
});

await client.chat.completions.create({
  model: "auto",
  messages,
});
  1. Connect

    Set the LineMod endpoint and API key.

  2. Keep your SDK

    Keep chat.completions.create and the same messages format.

  3. Update in Console

    Change routing for auto requests without redeploying.

Control routing from the gateway

Connect once. Tune cost, quality and backups.

Get Started