external-model-delegation

external-model-delegation is a skill for Claude Code from alinaqi/maggy. It costs 26 tokens per session (868 once invoked), scanned A, original, MIT.

A prompt-routing workflow that sorts each request into one of six model tiers, from a local Qwen model to Claude handling the task directly. The tiers are based on expected cost and performance.

In plain words
What is it for?
It helps classify prompts, call Qwen, DeepSeek, Kimi, or Codex through command-line scripts, and return the selected model's response.
Why use it?
It removes the need to manually choose an AI model for every request and can direct simpler work to lower-cost options.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: positional $N argument; runs codex exec; mentions Codex.

Good fit It helps classify prompts, call Qwen, DeepSeek, Kimi, or Codex through command-line scripts, and return the selected model's response.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alinaqi/maggy/external-model-delegation
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alinaqi/maggy --skill external-model-delegation
Clone the repo
git clone --depth 1 https://github.com/alinaqi/maggy

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for external-model-delegation

README.md
[![agentmods](https://agentmods.dev/badge/skills/alinaqi/maggy/external-model-delegation/github.svg)](https://agentmods.dev/skills/alinaqi/maggy/external-model-delegation)
Your own site
<a href="https://agentmods.dev/skills/alinaqi/maggy/external-model-delegation"><img src="https://agentmods.dev/badge/skills/alinaqi/maggy/external-model-delegation/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for external-model-delegation

Your own site · 80×15
<a href="https://agentmods.dev/skills/alinaqi/maggy/external-model-delegation"><img src="https://agentmods.dev/badge/skills/alinaqi/maggy/external-model-delegation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 868 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Data Exfiltration · line 22
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
  • medium Data Exfiltration · line 44
    Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
    Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.00868
Opus 5.5 $0.00010 $0.00347
Sonnet 5.5 $0.00005 $0.00174
Haiku 4.5 $0.00003 $0.00087

Measured 2mo ago against content hash eeda8d81946e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

external-model-delegation scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

├── qwen3 # Shell: curl to local Ollama API
skills/external-model-delegation/SKILL.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

External Model Delegation Pattern

A UserPromptSubmit hook classifies every user prompt into one of six cost/performance tiers. The hook injects additionalContext instructing Claude to run a specific delegation script and return the output.

Tier routing table

Tier Delegation command Cost
QWEN qwen3 "prompt" $0 (local Ollama)
DEEPSEEK_FLASH deepseek --flash "prompt" $0.14 / $0.28 per M tokens
DEEPSEEK_PRO deepseek --pro "prompt" $0.44 / $0.87 per M tokens
KIMI kimi --quiet -p "prompt" $0.60 / $2.50 per M tokens
CODEX codex exec varies
CLAUDE handle natively $3-5 / $15-25 per M tokens

Delegation script pattern

Each script is a self-contained executable in ~/bin/ that accepts a prompt and writes the response to stdout:

~/bin/
├── qwen3      # Shell: curl to local Ollama API
├── kimi       # Shell: execs Kimi CLI binary
├── deepseek   # Python: httpx to DeepSeek Anthropic-compat API
└── route-task # Shell + qwen3: classifies prompt into tier

Script contract

  1. Accept prompt as first argument: qwen3 "what is 2+2"
  2. Support --flash / --pro model flags (deepseek)
  3. Support --quiet mode flag (kimi)
  4. Write response to stdout, errors to stderr
  5. Exit 0 on success, non-zero on error

Writing a new delegation script

#!/bin/bash
# Minimal delegator template
PROMPT="$1"
API_KEY="${EXTERNAL_API_KEY:-}"
# Call external API, write result to stdout
curl -s https://api.example.com/chat \
  -H "Authorization: Bearer $API_KEY" \
  -d "$(jq -n --arg p "$PROMPT" '{prompt: $p}')" \
  | jq -r '.response'

Routing hook flow

User types prompt
    ↓
UserPromptSubmit hook fires
    ↓
qwen3 classifies into tier (QWEN|DEEPSEEK_FLASH|DEEPSEEK_PRO|KIMI|CODEX|CLAUDE)
    ↓
Hook injects additionalContext: "Run: <delegation-command>"
    ↓
Claude reads context, spawns delegation script, returns output
    ↓
User sees response from the delegated model

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed · +8 lines · +26 tokens per session eeda8d81946e
  2. 3mo ago First seen · 85 lines · 0 tokens per session scan A 5d4308a13ce8

Subscribe to this mod's changes

external-model-delegation is a skill published in the GitHub repository alinaqi/maggy (713 stars, last pushed 3d ago), licensed MIT. It adds 26 tokens to every session and 868 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

external-model-delegation compared with skills from other repositories

external-model-delegation next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
external-model-delegationalinaqi/maggySkill7133d agoMITA26Claude Code
claude-apihashgraph-online/awesome-codex-pluginsSkill1.6ktodayApache-2.0A53Claude Code, Codex
ai-ml-developmenttravisjneuman/.claudeSkill115yesterdayMITA43Claude Code
deep-learning-pythonMindrally/skillsSkill3231mo agoApache-2.0A30Claude Code
pytorchMindrally/skillsSkill3231mo agoApache-2.0A18Claude Code
machine-learningMindrally/skillsSkill3231mo agoApache-2.0A19Claude Code
mlops-industrializationMLOps-Courses/mlops-coding-skillsSkill231mo agoMITB48Claude Code, Codex