hung-phan/ml-skills/usage
Claude Code and agent skill by hung-phan/ml-skills
- community
Checking that the SKILL.md file is still in the repository.
litellm core usage — unified LLM interface across providers, completion/acompletion, streaming, function calling, embeddings, Router load balancing, fallbacks, retries, and cost tracking. Use when calling LLMs via litellm, setting up multi-provider routing, or configuring fallback strategies.
Install
npx vskill@latest install hung-phan/ml-skills/usageSKILL.md
The same SKILL.md was published earlier as hung-phan/ml-skills/usage.
litellm Usage
Unified interface for 100+ LLM providers via provider/model_name format.
Why This Exists
Problem: Using multiple LLM providers (OpenAI, Anthropic, Bedrock, Gemini) means maintaining separate SDK calls, different response shapes, and per-provider retry/fallback logic — coupling business logic to specific provider implementations.
Key insight: litellm.completion(model="provider/model", ...) normalizes every provider's response to the OpenAI format, so call sites look identical regardless of which model is behind them.
Reach for this when: Writing any code that calls an LLM — use this instead of provider SDKs directly so you can swap models, add fallbacks, or enable cost tracking without touching call sites.
Basic Completion
Provider Routing Format
Streaming
Function Calling / Tools
Embeddings
Fallbacks & Retries
Router (Load Balancing)
Routing Strategies
| Strategy | Best For | |
|---|---|---|
simple-shuffle | Default. Weighted random by rpm/tpm | |
latency-based-routing | Latency-sensitive workloads | |
usage-based-routing-v2 | Distribute load evenly | |
least-busy | Fewest in-flight requests | |
cost-based-routing | Minimize cost |
Router Fallbacks
Callbacks (Observability)
Cost Tracking
Global Settings
litellm.set_verbose = Trueis deprecated. Uselitellm._turn_on_debug()or setos.environ["LITELLM_LOG"] = "DEBUG"instead.
Gotchas
drop_params=Trueessential when routing across providers with different param sets- Bedrock requires
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION_NAME - Azure requires
AZURE_API_KEY,AZURE_API_BASE,AZURE_API_VERSION - Router
rpm/tpmlimits are soft — used for weighting, not hard enforcement num_retriesonly retries on APIError, Timeout, ServiceUnavailable (not 400s)- Async streaming returns the response object itself as the async iterator
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/usage/SKILL.md
Popularity
- Repository stars
- 2
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. 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/usage)