Posted in development on September 22, 2026 by Adrian Wyssmann ‐ 3 min read
If you use agentic coding tools like Oh My Pi (OMP), you quickly realize how fast token usage adds up. Every multi-file read, LSP check, and terminal loop generates context tokens. If you route everything through top-tier paid models, running your local coding setup gets expensive fast. I updated my models.yml setup in OMP to lower my API bills without giving up agent performance.
Here is how I organized my model routing. While my primary paid tier is ollama cloud whith deepseek-v4.1-flash as primary LLM, I enhance it with some free tiers from Cloudflare and Mistral.
A common assumption in AI is that bigger MoE models are always better. In practice with coding agents, that isn’t always true.
I recently switched my primary driver from ollama-cloud/deepseek-v4-flash to ollama-cloud/deepseek-v4.1-flash.
For day-to-day development, V4.1 Flash works as the primary workhorse.
To keep token usage lean, I offload smaller background tasks to free tiers:
@cf/meta/llama-3.2-3b-instruct to handle small jobs like git commit message generation and status labels.mistral-ai/codestral-latest for subagent routines (task role) because it handles local code context cleanly.Instead of letting OMP hit the default model for every background request, I map specific jobs to specific models:
| Role | Model | Purpose |
|---|---|---|
default | ollama-cloud/deepseek-v4.1-flash | Main coding loop |
task | mistral-ai/codestral-latest | Subagent delegations |
smol / commit | cloudflare-workers-ai/@cf/meta/llama-3.2-3b-instruct | Zero-cost lightweight tasks |
slow / plan / advisor | ollama-cloud/deepseek-v4-pro | Complex architectural planning |
models.yml)Here is my full models.yml file with providers, fallback cascades, and model roles configured:
providers:
ollama-cloud:
api_base: https://ollama.com/api
api_key: ${OLLAMA_CLOUD_API_KEY}
models:
- id: deepseek-v4.1-flash
context_window: 1000000
cost_per_1m_tokens: 0.15
- id: deepseek-v4-pro
context_window: 128000
cost_per_1m_tokens: 0.60
mistral-ai:
api_base: https://api.mistral.ai/v1
api_key: ${MISTRAL_API_KEY}
models:
- id: codestral-latest
context_window: 256000
cloudflare-workers-ai:
api_base: https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/ai/run
api_key: ${CF_API_TOKEN}
free_tier:
neurons_per_day: 10000
models:
- id: "@cf/meta/llama-3.2-3b-instruct"
context_window: 8192
roles:
default:
model: ollama-cloud/deepseek-v4.1-flash
fallback:
- ollama-cloud/deepseek-v4-pro
task:
model: mistral-ai/codestral-latest
fallback:
- ollama-cloud/deepseek-v4.1-flash
smol:
model: cloudflare-workers-ai/@cf/meta/llama-3.2-3b-instruct
fallback:
- mistral-ai/codestral-latest
commit:
model: cloudflare-workers-ai/@cf/meta/llama-3.2-3b-instruct
fallback:
- mistral-ai/codestral-latest
slow:
model: ollama-cloud/deepseek-v4-pro
fallback:
- ollama-cloud/deepseek-v4.1-flash
plan:
model: ollama-cloud/deepseek-v4-pro
fallback:
- ollama-cloud/deepseek-v4.1-flash
advisor:
model: ollama-cloud/deepseek-v4-pro
fallback:
- ollama-cloud/deepseek-v4.1-flash