⚡ OnyRouter — Automatic Model Selection
Let the system pick the best model per request: set the model field to onysoft/auto.
OnyRouter analyzes the incoming message, classifies the question type and routes the request to the best-fit model. There is no special endpoint — the familiar /v1/chat/completions with the model name "onysoft/auto". Routing is completely free; the request is billed only at the selected real model's catalog price.
/v1/chat/completions
"model": "onysoft/auto"
The standard chat completions endpoint — OnyRouter activates when the model field is onysoft/auto. All parameters, including streaming, work unchanged.
How It Works
There are two layers. The first is instant heuristics with zero added latency: messages carrying code signals (code blocks, error output, technical commands) go to the coding category; very short greetings go to the quick category.
Messages the heuristics can't settle are shown to a light, fast classifier model that returns a one-word category. Classification runs on the platform's own infrastructure — you pay neither tokens nor fees for it. The category is then mapped to a real model through a continuously updated routing table.
Categories and Routes
| Category | When is it chosen? | Routed class |
|---|---|---|
hizli | Short/simple questions, greetings, one-line lookups | Leading speed-class model |
genel | Normal conversation, writing, summarization, translation | Balanced flagship model |
kod | Programming, debugging, technical commands | Strongest balanced coding model |
derin | Multi-step analysis, strategy, math/logic | Reasoning flagship |
ekonomik | High-volume mechanical work such as batch classification/labeling | Best price/performance model |
gorsel | Image/photo analysis requests | Strong vision-capable model |
The routing table is updated as the model catalog evolves — your code keeps saying onysoft/auto while we keep the routes current.
Example Request
from openai import OpenAI
client = OpenAI(
base_url="https://api.onysoft.com/v1",
api_key="sk-ony-your-api-key",
)
response = client.chat.completions.create(
model="onysoft/auto",
messages=[{"role": "user", "content": "Bu Python kodundaki hatayı bul: ..."}],
)
print(response.model) # yönlendirilen gerçek model
print(response.choices[0].message.content)
curl https://api.onysoft.com/v1/chat/completions \
-H "Authorization: Bearer sk-ony-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "onysoft/auto",
"messages": [{"role": "user", "content": "Merhaba!"}]
}'
Transparency: Which Model Was Selected?
The model field of the response shows the routed real model (in streaming, the model field of the chunks). Your usage reports also list the request under the selected model's name. onysoft/auto additionally appears as a virtual model in the /v1/models list.
Billing
Routing and classification are free. The request is billed at the catalog price of the real model OnyRouter selects; there is no separate "router fee".
Limits and Notes
- On keys with a model lock (allowed_models), the request returns 403 if the selected model is not on the allow-list — use explicit model names on locked keys.
- The classifier layer can add a few seconds to time-to-first-token; for clear-cut cases like code or greetings the zero-latency heuristics kick in, so most requests won't feel it. Keeping latency-critical endpoints on fixed model names is a good middle ground.
For the full guide and architecture, see our blog post: OnyRouter