---
title: Deploy LiteLLM with AI
url: "/guides/litellm/"
canonical_url: https://docs.blossom88.com/guides/litellm/
markdown_url: https://docs.blossom88.com/guides/litellm.md
summary: Deploy LiteLLM with AI on Blossom. Give your apps a model gateway with restricted
  virtual keys, budgets, usage tracking, and managed PostgreSQL.
categories:
- deployment
- ai
---

# Deploy LiteLLM with AI

[LiteLLM](https://www.litellm.ai/) is an AI gateway that gives your apps a
consistent API for different model providers. Create separate virtual keys,
choose which models each app can use, and track usage in one dashboard.

The proxy uses Python and FastAPI, with a Next.js/React dashboard. This setup
uses PostgreSQL. Browse the [source on GitHub](https://github.com/BerriAI/litellm).

Run the gateway on regular App Capacity with managed PostgreSQL. Your model
provider runs the model; LiteLLM routes requests and records usage.

[Install the Blossom CLI and skill](/learn/getting-started/install/)
on your agent's machine and choose a Blossom Cloud Location when you log in.
You can also use
[Blossom BYOC (bring your own cloud)](/learn/getting-started/choose-your-cloud/#blossom-byoc).

## Ask Your Agent

> **Ask your AI agent:** Deploy LiteLLM on Blossom with managed Postgres. Help me create a model key with a budget.

> Follow this guide: https://docs.blossom88.com/guides/litellm/



Your agent checks the current
[LiteLLM deployment requirements](https://docs.litellm.ai/docs/proxy/deploy),
chooses a compatible maintained release, and saves the configuration. Supply
your model provider's API key through a private environment file.

| Part | Purpose |
|---|---|
| Gateway Service | Model API, routing, and administration dashboard |
| Managed PostgreSQL | Virtual keys, budgets, usage, and saved settings |
| Your model provider | Runs the model requests |

Keep a strong `LITELLM_MASTER_KEY` for administration and a stable
`LITELLM_SALT_KEY` for encrypted credentials. Keep both through updates. Configure
a model alias and reference the provider key through an environment variable.
Enable database-backed configuration and usage tracking.

### Open the Dashboard

Keep the site behind **Blossom Account access**. Configure private dashboard
credentials, then open `/ui` and sign in. Keep the master key out of application
clients; each app should get its own virtual key.

## Give Your App a Key

> **Ask your AI agent:** Create a key that can use my chosen model, give it an expiry and budget, and help me make a test request.

> Follow this guide: https://docs.blossom88.com/guides/litellm/



Select the allowed model, expiry, and budget. Make a short request through the
gateway, then confirm that usage appears for that key. Check that an anonymous
request and a request for an unallowed model are refused.

![LiteLLM showing an active virtual key and its usage budget.](/assets/images/guides/litellm/virtual-keys.png)

For an external client, allow only the intended inference routes through
Blossom's access policy. LiteLLM still requires the virtual key. Keep the
dashboard and administrative routes private.

<details class="optional-reading" markdown="1">
<summary>Commands behind the deployment</summary>

Create an App and prebuilt-image Environment, then create and link PostgreSQL:

    blossom app:create --data app.yml
    blossom environment:create --data environment.yml
    blossom database_instance:create --data postgres.yml --follow
    blossom environment_link:create --data database-link.yml
    blossom env_var:push --environment environment-100 --file .env.production
    blossom service:create --data gateway-service.yml
    blossom environment:deploy --id environment-100 --follow

The gateway reads `DATABASE_URL`. Preserve the image's production entrypoint,
provide its configuration file, and listen on port `4000`. Use an HTTP readiness
check at `/health/readiness`, which reports database connectivity. Let the
release's database initialization complete before using the gateway.

Example model configuration:

```yaml
model_list:
  - model_name: my-chat-model
    litellm_params:
      model: openai/your-model
      api_key: os.environ/OPENAI_API_KEY

general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
  database_url: os.environ/DATABASE_URL
  store_model_in_db: true
```

Supply the provider key, master key, salt key, and dashboard credentials
privately. Generate the configuration file from saved deployment settings when
the Container starts, or include a credential-free configuration in your image.
Don't keep the only copy on the Container's local disk.

An OpenAI-compatible client uses your gateway's HTTPS base URL with `/v1`,
the configured model alias, and its virtual key.

</details>

## Keep Keys and Usage Through Updates

> **Ask your AI agent:** Update LiteLLM and check that my app's key still works and its usage history is there.

> Follow this guide: https://docs.blossom88.com/guides/litellm/



Keep PostgreSQL, your model configuration, and application secrets stable.
Back up the database and follow the release's supported upgrade path.

The gateway Container can be replaced without a local data Volume. This guide
tests one instance. Before adding replicas, follow LiteLLM's current
[production guidance](https://docs.litellm.ai/docs/proxy/prod) for shared
configuration, Redis coordination, and rate limits.

## What You Get

- A model gateway and private administration dashboard
- Separate virtual keys with allowed models, expiry, and budgets
- Usage history in managed PostgreSQL
- An OpenAI-compatible API your apps can call
