Integrates TokenLab chat, image, audio, video, and other API families into code with runnable examples, model discovery, public contract checks, and agent-fi...
Coding
TokenLab Cost Routing
Try itChoose TokenLab models and fallback chains using public pricing, task fit, latency expectations, and native endpoint needs before writing production routing...
What it does
Choose TokenLab models and fallback chains using public pricing, task fit, latency expectations, and native endpoint needs before writing production routing...
The skill document
TokenLab Cost Routing
Use this skill when a user asks how to reduce TokenLab cost, compare model prices, pick fallbacks, or route requests by quality, latency, and budget.
What this skill should deliver
- A compact routing recommendation with exact public TokenLab model IDs.
- A cost-aware fallback chain for the user's workload.
- A catalog/pricing lookup path that can be rerun.
- A note on which endpoint family each model should use.
- Guardrails for when not to switch models because doing so would change output, safety, or request semantics.
Preferred approach
- Identify the workload and constraints:
- chat, coding, agent loop, image, video, audio, embedding, rerank, translation, or multimodal
- quality floor
- latency target
- budget or cost ceiling
- native endpoint requirement
- Read live public catalog signals before recommending:
GET https://api.tokenlab.sh/v1/modelsGET https://api.tokenlab.sh/v1/models?recommended_for=GET https://api.tokenlab.sh/v1/models/:modelGET https://api.tokenlab.sh/v1/models/:model/pricing
- Build a chain with roles:
- primary quality model
- balanced default
- fast fallback
- budget fallback
- If the user asks for exact cost, compute from live pricing and their estimated token/media volume. State units and assumptions.
- For non-chat requests, inspect model details before changing parameters or endpoint family.
Output format
- One sentence stating workload and assumptions.
- A table with
Route role,Model ID,Endpoint,Why, andWhen to fall back. - One catalog command and one pricing command.
- A short implementation note for retries, rate limits, and user approval when quality would drop.
Avoid
- Do not invent prices, discounts, or model counts.
- Do not choose a cheaper model if that would silently remove required native behavior, tools, media support, safety constraints, or structured output guarantees.
- Do not expose TokenLab internal channel, physical provider, or routing details.
- Do not turn a user-provided model into a different model without saying why.
- Do not hardcode a fallback list without saying when it was checked or how to refresh it.
Edge Cases
- If catalog or pricing endpoints are unavailable, say that routing cannot be price-verified and provide only an example pattern.
- If the user asks for "cheapest", include capability and reliability tradeoffs.
- If billing risk is high, require explicit user approval before adding automatic fallback to paid media/video generation.
Related skills
Pick TokenLab models for chat, coding, image, video, audio, embeddings, reranking, and translation by reading public model catalog signals before recommendin...
Use TokenLab native endpoint families such as Responses, Anthropic Messages, Gemini generateContent, media, audio, embeddings, and translations when OpenAI-c...
Estimate LLM task token usage, cost, and duration using rule-based classification and optional local profile data without external dependencies.
智能模型路由与Token成本优化顾问 / Smart LLM Router & Token Cost Optimizer. 帮助用户为不同复杂度的AI任务选择最合适的模型层级(从极致性价比到旗舰级), 通过任务复杂度评估、模型分级推荐、安全强制升级规则,在保证质量的前提下节省70-90%的Token成本。 同时提...
Audit-grade SQLite ledger that records every model call's token usage and cost from OpenClaw sessions.