litellm.completion(), litellm.responses(), and friends) and as a self-hosted proxy server with virtual keys, budgets, spend logs, fallbacks, load balancing, and an Admin UI. Teams use it to swap or mix providers without touching application code, and to give every app and agent one governed endpoint to call. ZeroGPU is a first-class LiteLLM provider, so zerogpu/<model> works on every LiteLLM surface with pricing and capability flags built in.
ZeroGPU is a compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly - classification, extraction, moderation, routing, summarization - at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and you’re live.
Overview
This guide covers LiteLLM’s nativezerogpu/ provider route, for Python developers using the LiteLLM SDK and for platform teams running the LiteLLM proxy. You’ll set your API key, make your first zerogpu/ call, and then work through every surface LiteLLM exposes for ZeroGPU: chat completions, streaming, tool calling, structured output, reasoning effort, image input, the Responses API, Anthropic Messages, the proxy and Admin UI, routing and fallbacks, cost tracking, and model metadata. By the end you’ll be able to put ZeroGPU behind a governed LiteLLM endpoint and route cheap, high-volume traffic to it while spend is tracked per request.
Cookbook
For a runnable, real-world example, see Build a Cost-Aware Inbound Lead Desk with LiteLLM and ZeroGPU. It runs a “Contact sales” inbox through a LiteLLM Router that qualifies and extracts each lead on ZeroGPU with strict JSON schemas, drafts replies on ZeroGPU while escalating hot enterprise deals to a frontier model, and prices every call against a GPT-4.1 baseline. Check it out to see the Router, fallbacks, and cost tracking from this guide working together.For more worked examples, browse the cookbook index for
end-to-end walkthroughs of classification, extraction, and PII workflows on
ZeroGPU’s small models.
Video walkthrough
Video walkthrough coming soon.Quickstart
Prerequisites
- Python 3.10 or newer.
- A LiteLLM release that includes the
zerogpuprovider (added in BerriAI/litellm#43874). Older releases rejectzerogpu/<model>withInvalid model name. - A ZeroGPU API key (starts with
zgpu-api-). - A text generation model from the model catalog. This guide uses
gpt-oss-120b.
Get your ZeroGPU API key
- Sign in to the ZeroGPU dashboard.
- Open API Keys and click Create key.
- Copy the key (starts with
zgpu-api-) and export it. LiteLLM readsZEROGPU_API_KEYautomatically.
Install LiteLLM
For the Python SDK:Your first request
zerogpu/ prefix tells LiteLLM which provider to use. LiteLLM strips it before the request leaves, so ZeroGPU receives gpt-oss-120b, and prices the call from its own cost map. The cost for this call is 72 x $0.15/1M + 35 x $0.60/1M = $0.0000318.
Usage
Every section below follows the same shape: what the surface does, which ZeroGPU endpoint it hits, its parameters, a runnable example, and the response you get back.The zerogpu/ route and supported models
LiteLLM registers zerogpu as an OpenAI-compatible provider at https://api.zerogpu.ai/v1. It sends chat calls to ZeroGPU’s /chat/completions, Responses calls to ZeroGPU’s native /responses, and Anthropic Messages calls through its own Messages-to-chat bridge. The route covers ZeroGPU’s text generation models. ZeroGPU’s classification, extraction, moderation, embedding, and audio models are not part of the LiteLLM route; call those through the ZeroGPU API or an official SDK.
These 13 models ship in LiteLLM’s model cost map with pricing and capability flags:
“Tools and JSON schema” means LiteLLM flags the model for
tools, tool_choice, and a json_schema response_format. The limits are the ones LiteLLM enforces for pre-call checks. The model catalog is the source of truth for ZeroGPU pricing; LiteLLM’s cost map is updated separately, so see Troubleshooting if the two drift.
Model IDs are case-sensitive. zerogpu/LFM2.5-1.2B-Instruct works; zerogpu/lfm2.5-1.2b-instruct does not.
Credentials and configuration
LiteLLM resolves ZeroGPU credentials in this order: a per-call argument, then the environment variable, then the default.api_base keeps the provider identity and pricing. Only the zerogpu/ prefix decides how LiteLLM prices and labels the call.
completion() and acompletion()
The core chat entry point. Hits ZeroGPU’s POST /v1/chat/completions with any model from the table above. acompletion() is the async twin with the same arguments.
ModelResponse in OpenAI chat completion shape, as in the Quickstart. response.usage carries token counts, including prompt_tokens_details.cached_tokens and, on reasoning models, completion_tokens_details.reasoning_tokens. response._hidden_params["response_cost"] carries the USD cost.
Streaming
Setstream=True to get chunks as they are generated. Add stream_options={"include_usage": True} to receive a final chunk with token counts, which LiteLLM also uses for cost.
ModelResponseStream with object: "chat.completion.chunk" and a delta. The last chunk has empty choices and a usage block:
Tool calling
Pass OpenAI-formattools and an optional tool_choice to any model flagged for tools in the model table. LiteLLM forwards them unchanged to ZeroGPU’s chat completions endpoint.
message.tool_calls is a list of {id, type: "function", function: {name, arguments}}, where arguments is a JSON string, and finish_reason is "tool_calls".
Structured output
Pass ajson_schema response_format to get output that matches your schema. Supported on every model flagged for JSON schema in the model table.
message.content is a JSON string that parses to {"city": "Paris"}. Some models pretty-print it, so always parse rather than compare strings.
You can also pass a Pydantic model class as response_format, and LiteLLM converts it to a json_schema for you.
Reasoning effort
reasoning_effort controls how long a reasoning model thinks before answering. LiteLLM forwards it only to ZeroGPU models flagged supports_reasoning: deepseek-v4.1-flash, glm-5.3-flash, gpt-5.4-nano, gpt-5.6-luna, gpt-6-luna, gpt-oss-120b, qwen3-30b-a3b-fp8, and qwen3.6-35b-a3b. The others, gpt-4.1-mini, both Llama models, and both LFM2.5 models, reject it with a 400.
usage.completion_tokens_details.reasoning_tokens and billed at the output rate. Set drop_params=True whenever the same code path can reach a non-reasoning model, for example behind a router or a wildcard.
Image input
gpt-6-luna and qwen3.6-35b-a3b are flagged supports_vision and accept image_url content parts, either a public URL or a base64 data URL.
litellm.supports_vision(model="zerogpu/<model>") before sending images from a generic code path.
responses()
LiteLLM’s Responses API entry point. For zerogpu/ models it calls ZeroGPU’s own POST /v1/responses natively rather than going through the chat completions bridge, so reasoning items and output items come back exactly as ZeroGPU returns them.
ResponsesAPIResponse with status: "completed", an output list (reasoning models return a reasoning item followed by a message item), and usage with input_tokens, output_tokens, and total_tokens.
Streaming yields response.created, response.in_progress, response.output_item.added, response.output_text.delta, response.output_text.done, response.output_item.done, and response.completed events:
Most ZeroGPU models ignore
previous_response_id. To continue a
conversation, send the earlier turns again in input rather than relying on
server-side state.Anthropic Messages
LiteLLM translates Anthropic Messages-shaped requests into ZeroGPU chat completions, so clients written for the Anthropic SDK can call ZeroGPU models without changes. In the SDK, uselitellm.anthropic.messages.acreate(); on the proxy, use POST /v1/messages.
LiteLLM Proxy
The proxy puts ZeroGPU behind one OpenAI-compatible (and Anthropic-compatible) endpoint with virtual keys, budgets, and spend logs. Add ZeroGPU deployments toconfig.yaml:
Start the proxy:
x-litellm-response-cost carries the USD cost of the call and x-litellm-call-id identifies it in spend logs.
Admin UI
You can add ZeroGPU without editingconfig.yaml. Open the proxy’s Admin UI at http://localhost:4000/ui, go to Models, then Add Model, and type “zero” into Provider to select ZeroGPU. Pick one or more of the 13 zerogpu/ models, paste your key into API Key, and save.
Models added in the UI need the proxy to run with a database (
DATABASE_URL).
Router, fallbacks, and load balancing
litellm.Router (and the proxy’s router_settings) groups deployments under one model_name, retries, and falls back to another group when a call fails. Use it to send traffic to ZeroGPU first and keep a frontier model as the safety net.
response.model tells you which deployment actually answered, so you can see how often the fallback fires.
Cost tracking
Everyzerogpu/ model is in LiteLLM’s cost map, so spend is computed per request with no extra setup. When ZeroGPU reports cached prompt tokens in prompt_tokens_details.cached_tokens, LiteLLM bills those at the cache read rate and the rest of the prompt at the input rate.
Model metadata and discovery
LiteLLM exposes the cost map entries so code can check limits and capabilities before calling.Patterns and recipes
Cheap first, frontier as the safety net. Put a ZeroGPU model in front of a frontier model with Routerfallbacks. Most traffic resolves on ZeroGPU at a fraction of the cost, and anything that errors or times out still gets an answer. Watch response.model (or the spend logs, grouped by provider) to see the real split and decide whether the fallback is earning its keep.
One alias, many capabilities. Expose a zerogpu/* wildcard on the proxy and set litellm_settings.drop_params: true. Clients can then send reasoning_effort to any model without knowing which ones support it; LiteLLM forwards it to the eight reasoning models and drops it for the rest instead of returning 400s.
Structured extraction on a small model. For “pull these fields out of this text” jobs, use response_format with a strict json_schema on gpt-6-luna or qwen3.6-35b-a3b rather than asking a large model for prose and parsing it. Check litellm.supports_response_schema() in shared code so a misconfigured model fails fast instead of returning unparseable text.
Budgeted keys per team or agent. With the proxy running against a database, mint a virtual key that can only call ZeroGPU models and stops at a budget. Each agent or team gets its own spend line, all priced from the zerogpu/ cost map:
At a glance
Troubleshooting
Invalid model name passed in model=zerogpu/... or LLM Provider NOT provided. Your LiteLLM release predates the zerogpu provider. Upgrade with pip install -U litellm (or pip install -U 'litellm[proxy]', or pull a newer proxy image), then restart the proxy.
AuthenticationError or 401 on every call. ZEROGPU_API_KEY is not set in the process that makes the call. On the proxy, the variable must be exported in the proxy’s own environment, and api_key in config.yaml must use the os.environ/ZEROGPU_API_KEY form, not a bare variable name.
A bad key returns 403 only after a noticeable delay. LiteLLM retries the upstream call twice before surfacing the 403. Fix the key in the dashboard; while debugging, pass num_retries=0 so failures come back immediately.
reasoning_effort returns 400 on some models. gpt-4.1-mini, the Llama models, and the LFM2.5 models don’t support it. Pass drop_params=True on the call, or set litellm_settings.drop_params: true on the proxy.
verbosity is rejected, or temperature is not dropped, on gpt-5.4-nano, gpt-5.6-luna, or gpt-6-luna. LiteLLM doesn’t yet apply its GPT-5 parameter rules to these ZeroGPU models. Omit verbosity, and leave temperature at its default on these models until a LiteLLM release fixes it.
Spend shows $0, unknown-model, or an empty provider. The deployment points at ZeroGPU with api_base but without the zerogpu/ prefix (for example model: gpt-5.6-luna or model: openai/gpt-5.6-luna), so LiteLLM treats it as generic OpenAI and has no price for it. Change model to zerogpu/<model-id>.
Prices in LiteLLM no longer match the ZeroGPU catalog. LiteLLM’s cost map is updated separately from ZeroGPU’s pricing. Set input_cost_per_token and output_cost_per_token in that deployment’s litellm_params to the current model catalog rates until the cost map catches up.
ContextWindowExceededError with enable_pre_call_checks. LiteLLM checks the prompt against the model’s max_input_tokens before calling. Move to a larger-window model such as deepseek-v4.1-flash or glm-5.3-flash, or add context_window_fallbacks so long prompts reroute automatically.
Embeddings or image generation fail on zerogpu/. The LiteLLM route covers text generation only. litellm.embedding(model="zerogpu/...") returns 400 before any upstream call, and image generation returns 404. Call ZeroGPU’s embeddings and task endpoints directly instead.
A multi-turn Responses conversation forgets earlier turns. Most ZeroGPU models ignore previous_response_id. Resend the earlier turns in input on each call.
Parallel tool calls on llama-3.1-8b-instruct-fast share one id. Matching tool results back to calls then fails. Pass parallel_tool_calls=False, or use gpt-6-luna or qwen3.6-35b-a3b for multi-tool turns.
429 responses under load. You are being rate limited. Set num_retries so LiteLLM backs off and retries, add rpm / tpm per deployment so the router spreads load, and move offline work to the Batch API.
Conclusion
LiteLLM gives every app and agent in your stack one governed endpoint, and its nativezerogpu/ route means ZeroGPU’s small and nano models sit behind that endpoint with pricing, capability flags, and spend tracking already in place. Route the high-volume, purpose-specific calls to ZeroGPU, keep a frontier model as a fallback for the rest, and let the spend logs show you what each request actually cost.
Model Catalog
Browse every model available on ZeroGPU and pick the best fit.
API Reference
Explore the OpenAI-compatible chat completions endpoint LiteLLM calls.
Cookbook
Worked examples for classification, extraction, and batch jobs.
Join Discord
Ask questions and share what you’re building.

