Route reads a prompt before your LLM does and tells you what kind of task it is (coding, summarization, open question, rewrite...) and how demanding it is: reasoning, creativity, domain knowledge, constraints and an overall complexity from 0 to 1.
Use it to pick a model per request, set token budgets, or understand what your users ask for. It takes about as long as a network round trip.
Use it
curl https://labs.greatwork.company/v1/run \
-H "Authorization: Bearer $GWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "route-1",
"input": "What'\''s the capital of Australia?"
}'const res = await fetch("https://labs.greatwork.company/v1/run", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.GWL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "route-1",
"input": "What's the capital of Australia?"
}),
});
const { output, usage } = await res.json();import os, requests
res = requests.post(
"https://labs.greatwork.company/v1/run",
headers={"Authorization": f"Bearer {os.environ['GWL_API_KEY']}"},
json={
"model": "route-1",
"input": "What's the capital of Australia?"
},
)
output = res.json()["output"]Set GWL_API_KEY to a key from your dashboard. The bare name route works too and follows new versions.
Options
input: A prompt, or an array of up to 64. The first 512 tokens are read.
No options: send input and that's it.
Output
| Field | Type | Meaning |
|---|---|---|
task | string | Most likely task: open_qa, closed_qa, summarization, text_generation, code_generation, chatbot, classification, rewrite, brainstorming, extraction or other. |
task_score | number | Its score, 0 to 1. |
tasks | object[] | Top 3 tasks with scores. |
complexity | number | Overall difficulty, 0 to 1. Averages run near 0.2; pick thresholds from your own traffic. |
dimensions | object | creativity, reasoning, contextual_knowledge, domain_knowledge, constraints, each 0 to 1. |
Every response wraps this in {"id", "model", "output", "usage": {"units", "unit", "cost_usd"}, "latency_ms"}. Send an array as input and output is an array in the same order.
Examples
Simple question
{
"model": "route-1",
"input": "What's the capital of Australia?"
}{
"task": "open_qa",
"task_score": 0.9953,
"tasks": [
{
"label": "open_qa",
"score": 0.9953
},
{
"label": "other",
"score": 0.0021
},
{
"label": "chatbot",
"score": 0.0007
}
],
"complexity": 0.0151,
"dimensions": {
"creativity": 0.0145,
"reasoning": 0.0161,
"contextual_knowledge": 0.1744,
"domain_knowledge": 0.0421,
"constraints": 0.0012
}
}Captured on our production servers: 35 ms, 1 text, $0.00002.
Hard code task
{
"model": "route-1",
"input": "Write a lock-free multi-producer single-consumer queue in Rust with bounded capacity, explain the memory orderings you chose, and include loom tests."
}{
"task": "code_generation",
"task_score": 0.995,
"tasks": [
{
"label": "code_generation",
"score": 0.995
},
{
"label": "open_qa",
"score": 0.007
},
{
"label": "text_generation",
"score": 0.007
}
],
"complexity": 0.7248,
"dimensions": {
"creativity": 0.5717,
"reasoning": 0.7566,
"contextual_knowledge": 0.5098,
"domain_knowledge": 0.8427,
"constraints": 0.3926
}
}Captured on our production servers: 52 ms, 1 text, $0.00002.
Rewrite
{
"model": "route-1",
"input": "Make this email sound friendlier: We have not received payment. Pay now."
}{
"task": "rewrite",
"task_score": 0.963,
"tasks": [
{
"label": "rewrite",
"score": 0.963
},
{
"label": "text_generation",
"score": 0.0361
},
{
"label": "code_generation",
"score": 0.0011
}
],
"complexity": 0.0822,
"dimensions": {
"creativity": 0.2529,
"reasoning": 0.1234,
"contextual_knowledge": 0.1381,
"domain_knowledge": 0.0723,
"constraints": 0.0991
}
}Captured on our production servers: 35 ms, 1 text, $0.00002.
Good for
- Route each prompt to the cheapest model that can handle it
- Set max_tokens by task type
- Report what your users ask an assistant for
- Send code questions to a code model
Limits and caveats
- Scores are relative: calibrate cutoffs on your own prompts.
- Not a safety classifier; pair it with Warden or Moat.
Pricing
$0.02 per 1,000 texts. One unit per text up to 2,000 characters; longer texts are split into 2,000-character chunks and each chunk is a unit. Failed calls aren't charged, and a call never costs more than its estimate (POST /v1/estimate tells you before you run it).
Built on
Horizon-Labs/multilingual-prompt-task-complexity-small, 141M (mmBERT-small encoder) parameters. License: Apache-2.0. We run it on our servers with our own long-text chunking and score aggregation.