dotfiles / litellm
AGENTS.md16 starsChanged 4 months agoMITView on GitHub
The free tier is account-wide, not per-model: 1000 requests/day across every :free slug (X-RateLimit-Limit: 1000, resets 03:00 local). Whatever burns it starves everything else. This bit hard on 2026-0
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository105 other files it gives its agents.
- ableton/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- aichat/AGENTS.mdAGENTS.md
- aider/AGENTS.mdAGENTS.md
- annepro2/AGENTS.mdAGENTS.md
- atuin/AGENTS.mdAGENTS.md
- btop/AGENTS.mdAGENTS.md
- chromium-vimium-extension/AGENTS.mdAGENTS.md
- claude-code/AGENTS.mdAGENTS.md
- codex/AGENTS.mdAGENTS.md
- contextMenu/AGENTS.mdAGENTS.md
- cron/AGENTS.mdAGENTS.md
- crush/AGENTS.mdAGENTS.md
- docker/AGENTS.mdAGENTS.md
- docker-logger/AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- eqmac/AGENTS.mdAGENTS.md
- eza/AGENTS.mdAGENTS.md
- firefox-vimium-addon/AGENTS.mdAGENTS.md
- fork/AGENTS.mdAGENTS.md
- hammerspoon/AGENTS.mdAGENTS.md
- hermes/AGENTS.mdAGENTS.md
- heroic/AGENTS.mdAGENTS.md
- homebrew/AGENTS.mdAGENTS.md
- iina/AGENTS.mdAGENTS.md
- immich/AGENTS.mdAGENTS.md
- install/AGENTS.mdAGENTS.md
- iterm/AGENTS.mdAGENTS.md
- karabiner/AGENTS.mdAGENTS.md
- keyboard-layout/AGENTS.mdAGENTS.md
- lazydocker/AGENTS.mdAGENTS.md
- lazygit/AGENTS.mdAGENTS.md
- macos/AGENTS.mdAGENTS.md
- macos_cleanup/AGENTS.mdAGENTS.md
- macos_update/AGENTS.mdAGENTS.md
- marta/AGENTS.mdAGENTS.md
- mistral-vibe/AGENTS.mdAGENTS.md
- noti/AGENTS.mdAGENTS.md
- npm/AGENTS.mdAGENTS.md
- opencode/AGENTS.mdAGENTS.md
- python/AGENTS.mdAGENTS.md
- qdrant/AGENTS.mdAGENTS.md
- qwen-code/AGENTS.mdAGENTS.md
- rag/AGENTS.mdAGENTS.md
- rtk/AGENTS.mdAGENTS.md
- tmux/AGENTS.mdAGENTS.md
- uv/AGENTS.mdAGENTS.md
- voiceink/AGENTS.mdAGENTS.md
- vscode/AGENTS.mdAGENTS.md
- xcode/AGENTS.mdAGENTS.md
- zap/AGENTS.mdAGENTS.md
- zsh/AGENTS.mdAGENTS.md
- ableton/CLAUDE.mdCLAUDE.md
- aichat/CLAUDE.mdCLAUDE.md
- aider/CLAUDE.mdCLAUDE.md
- annepro2/CLAUDE.mdCLAUDE.md
- atuin/CLAUDE.mdCLAUDE.md
- btop/CLAUDE.mdCLAUDE.md
- chromium-vimium-extension/CLAUDE.mdCLAUDE.md
- claude-code/CLAUDE.mdCLAUDE.md
- The first 60 shown.
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
Keep it for interactive/low-volume chat.
- Distinctive: line 41
Before assuming a provider "died", check whether one consumer drained a shared quota.
- Distinctive: line 42
Prefer providers with per-model buckets (io.net ~500K tokens/day per model, Cloudflare's own neuron pool, NIM) for anything on a timer.
- Distinctive: line 126
Verify after any cache change — this is the regression test:
- Distinctive: line 141
Cost of exact-match: no paraphrase hits, so a lower hit rate and slightly more quota burn.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md 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.
Files
litellm — agent rules
Models and providers
- Free models only. After any config.yaml edit:
scripts/verify-free-only.shmust exit 0. - OpenRouter deployments use
openai/<slug>+api_base: https://openrouter.ai/api/v1. Neveropenrouter/<slug>. - Groq deployments use native
groq/<slug>(noapi_base). - Z.AI deployments use native
zai/<slug>(noapi_base). - Mistral deployments use native
mistral/<slug>(noapi_base). - Gemini deployments use native
gemini/<slug>(noapi_base). - Cerebras deployments use
openai/<slug>+api_base: https://api.cerebras.ai/v1. - NVIDIA NIM deployments use
openai/<slug>+api_base: https://integrate.api.nvidia.com/v1. - Cloudflare Workers AI deployments use
openai/@cf/<slug>+api_base: https://api.cloudflare.com/client/v4/accounts/<account-id>/ai/v1(the OpenAI-compat endpoint; NOT LiteLLM's nativecloudflare/provider). KeyCLOUDFLARE_API_KEY(thecfut_Workers-AI token — distinct fromCLOUDFLARE_API_TOKEN, thecfat_DNS/tunnel token). Free: 10 000 neurons/day, no billing on the free plan (over-quota → 429).verify-free-only.shwhitelists theapi.cloudflare.com/.../ai/v1host by prefix. Aliases:cloudflare-kimi-code(K2.7 Code),cloudflare-llama(3.3-70b-fp8-fast),cloudflare-llama-guard(Llama Guard 3 8B — separate moderation bucket, NOT in themoderationshuffle to avoid guard-verdict-format roulette); also order:2 members ofcoding/fast/reasoning(reasoning =@cf/qwen/qwq-32b). Gated on CF free (403, don't add): GLM-5.2, llama-3.2-11b-vision. - Aliases
coding reasoning fast vision embed auto coder nemotron gpt glm uncensored web-searchare referenced by../rag/ ../aider/ ../crush/ ../opencode/ ../codex/ ../qwen-code/ ../zsh/functions/qwen.sh [ai.sh](ai.sh). Add — don't rename. (deepseekdirect alias dropped 2026-06-02 — usenvidia-deepseek/sambanova-deepseek/reasoninginstead.) extractalias — gemini-flash-lite withtemperature: 0for factual extraction (numbers/tables/facts from documents; 1M context, own 1500 RPD bucket). Use it instead offast/codingwhen the task is "pull data out verbatim" — randomness only adds hallucination risk there.- TTS aliases:
tts(Gemini, primary),tts-piper(local Piper Russian, always available),tts-kokoro(local Kokoro-82M ENGLISH via MLX, highest-quality small TTS on Apple Silicon),tts-azure(Greek skill),tts-azure-ru(Azure Russian fallback). Fallback chain:tts → tts-piper → tts-azure-ru. Usettsfor Russian speech; usetts-kokorofor English (Kokoro is English-first — for Russian stay ontts-piper); do NOT usetts-azurefor Russian (it's voice-agnostic, used by greek-tts skill with explicit Azure voice ids). host.docker.internalapi_base entries (tts-piperon:8177,voiceink-localon:8178,tts-kokoroon:8179) are local shims — free, no paid quota.verify-free-only.shwhitelists this host explicitly. The Kokoro shim (kokoro-shim/app.py, launchdcom.servitola.kokoro-shim) loads Kokoro-82M on MLX once at startup;voiceaccepts Kokoro voices (af_*/am_*American,bf_*/bm_*British), else falls back toaf_heart.- Port stays
127.0.0.1:4000. UI creds stay${LITELLM_UI_*:?...}— never hardcoded. embedalias usesnvidia/llama-nemotron-embed-vl-1b-v2on NVIDIA NIM (2048-dim,input_type: query,encoding_format: float). Moved off OpenRouter 2026-07-22 — see the shared-bucket section below. Changing the model breaks every Qdrant collection that used it — coordinate with../rag/. Bothinput_type: queryandencoding_format: floatare load-bearing; see theembedblock in config.yaml.
OpenRouter is ONE shared 1000-req/day bucket — don't let a cron eat it
The free tier is account-wide, not per-model: 1000 requests/day across every :free slug
(X-RateLimit-Limit: 1000, resets 03:00 local). Whatever burns it starves everything else.
This bit hard on 2026-07-22. embed was an OpenRouter deployment and rag-improve runs twice an
hour (~130 + ~260 embeddings per run ≈ 9 000 calls/day, ~9× the entire allowance). Result: all
~30 OpenRouter chat deployments 429'd with free-models-per-day-high-balance — nemotron*,
gemma-4*, poolside, plus the whole moderation alias and 3/4 of vision. It looked like a
dozen unrelated models had died. It was one starved bucket, and the cause was RAG.
Fixed by moving embed to NVIDIA NIM, which hosts the same model on an independent quota:
cosine(OpenRouter, NIM input_type=query) = 1.000000 over 2048 dims, so no Qdrant re-embed was
needed. input_type: query is load-bearing — passage scores only 0.637 against stored vectors.
Rules:
- Never put a high-volume automated consumer (embeddings, cron jobs, bulk eval) on OpenRouter.
Keep it for interactive/low-volume chat. Check
curl https://openrouter.ai/api/v1/key— but note it reports the credit limit; the request bucket is only visible in theX-RateLimit-*headers of an actual 429. - Before assuming a provider "died", check whether one consumer drained a shared quota.
- Prefer providers with per-model buckets (io.net ~500K tokens/day per model, Cloudflare's own neuron pool, NIM) for anything on a timer.
Adding/removing OpenRouter models — avoid the intermittent-400 trap
A :free OpenRouter slug is load-balanced across MANY backend providers, and they don't all accept the same request params — some reject encoding_format, response_format, tools, etc. → sporadic 400/422 that come and go on retry and that num_retries can't escape (it re-hits the same bad routing). This bit embed (RAG refresh aborted on encoding_format). Rules:
- Pin every OpenRouter deployment to param-compatible backends. Add to its
litellm_params:
Optional steering:extra_body: provider: require_parameters: true # only route to backends that support all sent paramsprovider: {sort: throughput}, ororder: [...]/ignore: [...]to avoid known slow/bad backends. - Symptom to recognise:
BadRequestError ... "code":"invalid_value" ... "path":["encoding_format"](or any param) — and especially when it's intermittent (some calls 200, some 400). That's backend roulette, not your config or the caller. Diagnose by probing/v1/embeddings(or/chat/completions) several times; a healthy model is 200 every time. - BUT:
encoding_formatspecifically was NOT backend roulette. Diagnosed 2026-07-22 — theembed400 was 5/5 permanent, not sporadic, andrequire_parameters: truedid not help. Root cause: when the caller omitsencoding_format, the OpenAI SDK inside LiteLLM defaults it tobase64, which NVIDIA embeddings reject outright. Fix isencoding_format: floatin the deployment'slitellm_params(now set). Check the SDK default before blaming the provider. - Fallbacks now exist for the rotation groups too (
coding → fast → reasoning,reasoning → coding,fast → coding,vision → gemini-flash-lite), pluscontent_policy_fallbacksforuncensored. Direct provider aliases still have NO fallback by design.embedstill has none: anyembedfallback MUST be the same model + dimension (2048), or Qdrant queries return garbage. /v1/modelslists the alias, NOT health. A model can be listed and still 400 at call time. Always probe the actual endpoint after adding/swapping, not justmodels. Runscripts/smoke-test.py— that is what it is for.
Testing that models actually work — scripts/smoke-test.py
check-models.py is a catalog check ("does the provider list this slug?"). It is necessary but
badly insufficient: on 2026-07-22 it reported a healthy config while 26 of 65 aliases failed every
live call. scripts/smoke-test.py calls the models.
scripts/smoke-test.py # full: /health sweep + per-alias probe + group coverage
scripts/smoke-test.py --quick # skip the ~60s /health sweep
scripts/smoke-test.py --alias coding
scripts/smoke-test.py --json # for cron/alertingExit 0 ok · 1 permanent breakage or a rotation group under its floor · 2 proxy down.
Runs daily at 06:40 via cron/cron_jobs/litellm-smoke.cron; log /tmp/litellm-smoke.log.
Three non-obvious things it gets right — replicate them in any ad-hoc probe:
- Always send
{"cache": {"no-cache": true}}. Without it you measure Redis, not the providers. The first naive sweep reported 53/65 "OK" at ~0.2 s each; every one was a cache hit. Truth: 39/65. - Use a big
max_tokens(800+). Atmax_tokens: 16every reasoning model returns emptycontentwithfinish_reason: length— the budget goes to reasoning tokens. Twelve models looked dead for exactly this reason and were fine. - Never treat 429 as dead. On a free-tier pool 429 is the normal steady state. Only
permanent(dead slug / dead key / needs payment) justifies editingconfig.yaml.
Rotation groups hide rot. coding shuffles across N deployments, so N−1 can be dead without a
single request visibly failing — it was at 8/18 live when this was found. The group-coverage floors
in GROUP_FLOORS are the guard; the daily cron is what makes it matter.
Consumers — what routes through this proxy
This is the free-tier hub: the things that talk to an LLM but shouldn't burn
paid quota point at 127.0.0.1:4000. The primary AI coding tool — Claude Code —
does NOT route through here; it uses the paid Anthropic API directly. This proxy
serves the free lane: CI/bulk jobs, image work, RAG, the ai CLI, and the
experimental coding agents. If you change an alias, port, or the embed model,
these break:
aiCLI + RAG (the real daily consumers):ai.sh(theaicommand) and../rag/—embedfor every Qdrant collection + chat models forrag ask/improve/answer-eval. These two matter day-to-day; everything below is experimental.- Experimental coding agents — default model each picks:
../opencode/→coding(smallfast);../qwen-code/→coder-model;../aider/→coding(weakglm). Theautomodel-group and thecoder/coder-model/qwen-codealiases all resolve tocoding. Exceptions:../mistral-vibe/defaults to its owndevstral-small;../codex/defaults to its owngpt-5.6-terra(litellm only via-c model_provider=litellm -c model=gpt). All experiments — not used for real coding work; Claude Code is. - Other CLIs / shell:
../zsh/functions/qwen.sh(qm),../mistral-vibe/(vibe),../aichat/. - Voice/TTS:
../voiceink/via thevoiceink-localshim (:8178), thegreek-ttsskill viatts-azure,piper-shim/viatts-piper(:8177).
Invariant: the proxy (and its docker stack) must be up first — rag status
checks it. Consumers fail loudly if it's down (fail-fast convention).
Caching
Exact-match Redis cache (cache_params.type: redis), TTL 24h,
supported_call_types: ["acompletion", "atext_completion"] so embeddings and audio are never cached.
Why NOT semantic — a real correctness bug, do not re-enable casually
redis-semantic was dropped 2026-07-22. It keys on the prompt embedding only, not the model.
One prompt sent to four unrelated aliases returned the byte-identical response id:
mistral-small / groq-llama / cohere-command-a / cloudflare-llama
-> id=d005e3757cb7484ea0de1bdf20134898 'Titan' (the 4th was a PARAPHRASE)LiteLLM rewrites the response's model field to whatever the caller asked for, so the substitution
is invisible downstream. Real consequences: moderation / cloudflare-llama-guard safety
verdicts could be served by a general chat model; vision could return a text model's reply; and
every model-vs-model comparison through this proxy was meaningless.
Verify after any cache change — this is the regression test:
# same prompt, different aliases -> ids MUST differ; repeating one alias MUST hit cache
for m in mistral-small groq-llama cohere-command-a; do
curl -s localhost:4000/v1/chat/completions \
-H "Authorization: Bearer ${LITELLM_MASTER_KEY:?}" \
-H 'Content-Type: application/json' \
-d "{\"model\":\"$m\",\"messages\":[{\"role\":\"user\",\"content\":\"Largest moon of Saturn? one word\"}],\"max_tokens\":64}" \
| jq -r '"\(.model) \(.id)"'
doneOther facts:
- Redis image:
redis/redis-stack-server. Still required if you ever go back to semantic (RediSearch module); harmless for exact-match. - Cost of exact-match: no paraphrase hits, so a lower hit rate and slightly more quota burn. Correct answers are worth more. It also subsumes two older workarounds — the 0.85→0.92 threshold bump (гречка vs рис) and the vision/image-bytes hazard — because exact keys hash the whole request body, images and model included.
- Per-request
{"cache":{"no-cache":true}}still works and is still correct in callers that use it (bin/foodai.sh). Mandatory in any health/benchmark probe. - If you re-enable semantic:
redis_semantic_cache_embedding_modelmust be a provider-prefixed string (mistral/mistral-embed), never amodel_listalias — the cache resolver runs before the router exists.REDIS_PASSWORD: ""must be in litellm's compose env. Flush first:docker exec litellm-redis redis-cli FT.DROPINDEX litellm_semantic_cache_index DD.
After any change
scripts/verify-free-only.sh && docker compose restart
scripts/smoke-test.py # models must actually ANSWER, not just be listed/v1/models only proves an alias is registered. Use the smoke test.
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
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.

