AI Agent Hub
Back to skills
Free API Usage Optimization icon

Free API Usage Optimization

AI Agent Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_4baa9e94/apiusageoptimization into your AI assistant.

About this skill

Problem It Solves

Multiple free model APIs can reduce costs, but real setups often require maintaining model lists, comparing quotas, choosing models by task, and falling back when the primary model is rate-limited or fails. For engineers managing several API keys, this configuration can become scattered and hard to keep current as free quotas, QPS limits, and availability change.

How It Works

The skill breaks free model integration into executable steps:

  • Automatic discovery: discover.js refreshes available free models and reduces manual list maintenance.
  • Smart routing: router.js routes requests by task type, for example free models for chat or translation and the primary model for complex code, reasoning, or vision work.
  • Seamless fallback: fallback.js switches to backup models when the primary model fails and supports recovery behavior.
  • Three modes: royal, balanced, and savings prioritize the primary model, balance cost and quality, or prefer free models.

Configuration typically starts with OPENROUTER_API_KEY, optionally SILICONFLOW_API_KEY, DEEPSEEK_API_KEY, ZHIPU_API_KEY, and NVIDIA_API_KEY, then generates and applies the routing settings.

Boundaries

It fits local workflows that need several free or low-cost model APIs, not scenarios that assume unlimited free usage. Free models may have QPS, volume, or availability limits; production setups should keep at least two or three backup models and avoid committing API keys to repositories.

Use Cases

  • Route translation and writing to free models while keeping code reasoning on the primary model.
  • Fall back to SiliconFlow or OpenRouter models when the primary API is rate-limited or fails.
  • Refresh OpenRouter free model lists daily and remove invalid keys or unavailable models.
  • Switch to savings mode so the primary model becomes free, with the original model as backup.

Best For

  • Engineers managing multiple LLM API keys who need task-based routing to reduce spend.
  • Independent developers using paid APIs who want free models only as failure fallbacks.
  • Cost-sensitive developers who want chat and translation tasks routed to free models.
  • Backend engineers maintaining agent workflows who need fallback and routing config for clients.