hung-phan/ml-skills/production
Claude Code and agent skill by hung-phan/ml-skills
- community
Checking that the SKILL.md file is still in the repository.
Production litellm configuration — shared aiohttp session for connection pooling, OTel tracing, Redis/disk cache tiering, param tolerance. Use when initializing litellm for high-throughput services or configuring LLM response caching.
Install
npx vskill@latest install hung-phan/ml-skills/productionSKILL.md
The same SKILL.md was published earlier as hung-phan/ml-skills/production.
litellm Production Config
Why This Exists
Problem: LiteLLM's defaults (no explicit control over the shared HTTP connection pool / no deterministic session cleanup, no caching, no tracing) cause TCP churn, file-descriptor exhaustion, high P99 latency, and silent cost overruns when running at production scale.
Key insight: Three settings — a shared aiohttp session, a response cache, and OTel callbacks — eliminate the most common production failure modes with minimal configuration.
Reach for this when: Deploying a service that makes high-throughput LLM calls, integrating LiteLLM into a FastAPI app, or needing reproducible behavior in production vs. local dev.
Deployment Option Decision Table
| Deployment Mode | Best For | Connection Pooling | Caching | Multi-Instance Support | |
|---|---|---|---|---|---|
Direct SDK (litellm.completion) | Single-process apps, scripts, notebooks | Manual (shared session) | In-process only | No shared state | |
Router (litellm.Router) | Load balancing across model groups, fallbacks | Per-router session | In-process only | No shared state | |
LiteLLM Proxy (litellm --config) | Multi-team shared gateway, centralized auth/logging | Managed by proxy | Redis shared across instances | Yes — single control plane |
Rule of thumb: Single service calling LLMs → direct SDK with shared session. Multiple services or teams → LiteLLM Proxy with Redis cache.
Shared aiohttp Session (Connection Pooling)
By default litellm lazily creates a single shared aiohttp.ClientSession (the module-level base_llm_aiohttp_handler singleton; aiohttp is now the default transport). That default applies the built-in connector limits but you cannot size the pool per your workload or deterministically close it on shutdown. Override it with your own session to set explicit connector limits and guarantee cleanup:
Close on shutdown: await client_session.close()
Core Settings
Response Cache (Redis / Disk)
FastAPI Lifespan Integration
Gotchas
is_initializedguard prevents double-init on hot reloadclient_session.close()after yield ensures no leaked connectionsdrop_params=Trueis essential when routing to multiple providers (Bedrock, OpenAI, Anthropic)- Redis
ssl=Truerequired for AWS managed Redis/Valkey callbacks=["otel"]requires an OTel SDK configured in your process
References
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ml-review/references/ml-libraries/litellm/production/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hung-phan/ml-skills/production)