agentleFS
zhangliang0115zhangliang0115/ai-plugin/skills/deepseek-cost-router/SKILL.md

deepseek-cost-router

Skill0 starsChanged 2 months agoMITView on GitHub

Route coding tasks between DeepSeek chat and reasoning models (deepseek-chat vs deepseek-reasoner) to minimize API cost while keeping quality. Use when configuring an agent to use DeepSeek, choosing a model for a task batch, or optimizing token spend.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Default to chat for: file edits driven by clear instructions, renames, boilerplate, doc updates, formatted output, summarization, simple …

    line 24
  2. Distinctive:

    If the result fails review/tests, re-run just that unit on reasoner.

    line 35

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Routing work to the right DeepSeek model

DeepSeek exposes two behaviors through its OpenAI-compatible API:

  • deepseek-chat — the fast, non-thinking path. Cheap, low latency.
  • deepseek-reasoner — the thinking path (chain-of-thought before the final answer). Slower and pricier per call, dramatically better on hard reasoning.

The routing skill: run routine volume on chat, escalate only reasoning-heavy work.

Escalation heuristics

Default to chat for: file edits driven by clear instructions, renames, boilerplate, doc updates, formatted output, summarization, simple lookups, bulk repetitive transformations.

Escalate to reasoner for: non-obvious bugs (state/caching/async/race), algorithm design, architecture tradeoffs, tricky merges, math, contract or spec violations, "the tests fail and the cause is unclear".

A cheap escalation ladder for agent harnesses that support it:

  1. Try the task on chat with a tight instruction.
  2. If the result fails review/tests, re-run just that unit on reasoner.
  3. Feed the reasoner's answer back as the accepted fix; continue on chat.

Escalating units of failure instead of whole sessions keeps the premium model's token share small.

Cost mechanics worth knowing

  • Context caching: repeated identical prefixes (system prompt, long file context) hit DeepSeek's automatic prefix cache and are billed at the much cheaper cache-hit rate. Keep your system prompt and repo map stable and first in the prompt; don't shuffle dynamic content in front of them.
  • Reasoner output is token-hungry: thinking tokens bill as output. A reasoner call can cost many multiples of a chat call — reserve it.
  • Batch offline work (code review of a branch, doc generation) into dedicated sessions where the shared context prefix is reused.

Wiring DeepSeek into coding agents

DeepSeek's API is OpenAI-compatible, and Anthropic-compatible endpoints are documented for harnesses like Claude Code — see the official integration hub: https://api-docs.deepseek.com/guides/coding_agents (per-tool guides for Claude Code, OpenCode, OpenClaw, Codex and more). You need:

  • DEEPSEEK_API_KEY from https://platform.deepseek.com
  • The base URL (https://api.deepseek.com) and model id set in your tool's provider config — follow the per-tool guide for exact env vars.

DeepSeek Harness (dsh) reads DEEPSEEK_API_KEY directly; if aipx doctor warns it's missing, export it before launching.

Verify

  • Spot-check 10 recent tasks: would reasoner have changed the outcome? If no, your routing is right.
  • Watch spend per model in the platform dashboard; a healthy setup keeps reasoner tokens a small fraction of total while review pass-rates hold.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.