Skip to main content
A coding assistant spans the full complexity range - from single-line autocomplete suggestions to multi-file refactors, architecture questions, and debugging complex logic. Unlike a chatbot, the quality floor matters more: a wrong code suggestion costs developer time. Savings on this workload: typically 30–45% vs Claude Sonnet 4.6 baseline. Savings are lower than a chatbot because code tasks skew toward STANDARD and COMPLEX tiers - but the savings on the 40–50% of requests that route below STANDARD are still substantial.
SettingValueReason
Tier floorSTANDARDNever use NANO/SIMPLE/LIGHT for code - quality matters
Tier ceilingCOMPLEXAllow Claude Opus, DeepSeek V4 Pro, or GPT-5.5 for hard algorithmic tasks
Cost cap$0.05/requestCode prompts can be long; $0.05 is generous but bounded
VisionOptionalEnable if users can paste screenshots of code/errors
Tool callingOnEnable if the assistant calls functions (file read, terminal, etc.)
Tool quality70%+Require reliable tool use - code assistants often call tools

Step 1 - Create the profile

  1. Go to Playground → Configure
  2. Name it Code Assistant
  3. Set tier floor: STANDARD, ceiling: COMPLEX
  4. Set cost cap: $0.05
  5. Enable Tool calling if your assistant uses tools
  6. If tool calling is on, set tool quality to 70% minimum
  7. Click Save & get API key

Step 2 - Use the profile key in your app

Node.js - with tool calling

import OpenAI from "openai";

const client = new OpenAI({
  apiKey:  "sk-routor-YOUR_PROFILE_KEY",
  baseURL: "https://api.routor.io/v1",
});

const tools: OpenAI.Chat.ChatCompletionTool[] = [
  {
    type: "function",
    function: {
      name:        "read_file",
      description: "Read the contents of a file",
      parameters: {
        type:       "object",
        properties: { path: { type: "string" } },
        required:   ["path"],
      },
    },
  },
];

const response = await client.chat.completions.create({
  model:    "auto",
  messages: [
    { role: "system", content: "You are an expert software engineer." },
    { role: "user",   content: "Refactor the auth module in src/auth.ts to use async/await instead of callbacks." },
  ],
  tools,
  tool_choice: "auto",
});

// Routor picks STANDARD or higher - never routes code tasks to NANO/SIMPLE
console.log(response.choices[0].message);

Python

from openai import OpenAI

client = OpenAI(
    api_key="sk-routor-YOUR_PROFILE_KEY",
    base_url="https://api.routor.io/v1",
)

def ask_code(prompt: str, context: str = "") -> str:
    messages = [
        {"role": "system", "content": "You are an expert software engineer."},
    ]
    if context:
        messages.append({"role": "user", "content": f"Context:\n{context}"})
    messages.append({"role": "user", "content": prompt})

    response = client.chat.completions.create(
        model="auto",
        messages=messages,
    )
    return response.choices[0].message.content

# Simple task → routes to STANDARD (Claude Sonnet 4.6 / GPT-5.4)
result = ask_code("What does this function do?", context="def foo(x): return x * 2")

# Complex task → routes to COMPLEX (Claude Sonnet, or DeepSeek Reasoner for proofs/derivations)
result = ask_code("Rewrite this entire authentication module to use JWT with refresh token rotation", context=open("auth.py").read())

How routing looks for code tasks

TaskExpected tierTypical model
”What does x?.foo mean in TypeScript?”STANDARDClaude Haiku 4.5
”Write a regex to match email addresses”STANDARDGPT-5.4
”Refactor this 200-line auth module”COMPLEXClaude Sonnet 4.6
”Implement a lock-free concurrent queue in Rust”COMPLEXClaude Sonnet 4.6
”Prove this sorting algorithm is O(n log n)“COMPLEXDeepSeek Reasoner
”Design a distributed rate limiter”COMPLEXClaude Sonnet 4.6

Streaming for autocomplete

If you’re building an IDE extension or real-time autocomplete, enable streaming:
const stream = await client.chat.completions.create({
  model:    "auto",
  messages: [{ role: "user", content: "Complete this function: function binarySearch(arr, target) {" }],
  stream:   true,
  max_tokens: 200,
});

let result = "";
for await (const chunk of stream) {
  const delta = chunk.choices[0]?.delta?.content ?? "";
  result += delta;
  process.stdout.write(delta); // stream to user
}

Cost estimate

On a coding assistant handling 2,000 requests/day:
ScenarioDaily cost
All requests to Claude Sonnet 4.6~$60
With Routor (STANDARD→COMPLEX profile)~$35–42
Savings~$18–25/day
Savings are lower than a chatbot because code tasks are genuinely harder and route to higher tiers. But the STANDARD floor means quality never drops below a capable model.