# Add Key

> Generate a new API key on a live LiteLLM proxy. Asks for alias, scope (user/team), budget, models, and expiry, then calls POST /key/generate. Use when the user wants to create, generate, or provision an API key on a LiteLLM proxy instance.

- **Type:** Skill
- **Install:** `agentstack add skill-berriai-litellm-skills-add-key`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [BerriAI](https://agentstack.voostack.com/s/berriai)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [BerriAI](https://github.com/BerriAI)
- **Source:** https://github.com/BerriAI/litellm-skills/tree/main/add-key
- **Website:** https://github.com/BerriAI/litellm-skills

## Install

```sh
agentstack add skill-berriai-litellm-skills-add-key
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Add Key

Generate a new API key on a live LiteLLM proxy.

## Setup

Ask for these if not already known:
```
LITELLM_BASE_URL  — e.g. https://my-proxy.example.com
LITELLM_API_KEY   — proxy admin key
```

API reference: https://litellm.vercel.app/docs/proxy/virtual_keys

## Ask the user

1. **Key alias** (optional but recommended, e.g. `my-app-prod`)
2. **Scope** — assign to a `team_id` or `user_id`? (optional)
3. **Allowed models** (optional, e.g. `gpt-4o, claude-3-5-sonnet`)
4. **Max budget** (optional, e.g. `5.00`)
5. **Expiry** (optional, e.g. `7d`, `30d`, `90d`) — omit for no expiry

## Run

```bash
BASE="$LITELLM_BASE_URL"
KEY="$LITELLM_API_KEY"

curl -s -X POST "$BASE/key/generate" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key_alias": "",
    "team_id": "",
    "user_id": "",
    "models": [],
    "max_budget": ,
    "duration": ""
  }'
```

## Verify

Confirm the key was created:
```bash
curl -s "$BASE/key/info" \
  -H "Authorization: Bearer " | python3 -c "
import sys, json
d = json.load(sys.stdin)
info = d.get('info', {})
print(f'Alias: {info.get(\"key_alias\")}')
print(f'Expires: {info.get(\"expires\")}')
print(f'Budget: {info.get(\"max_budget\")}')
print(f'Models: {info.get(\"models\")}')
"
```

## Output

Show the user:
- `key` — the actual key value (only shown once, tell them to save it)
- `key_alias`, `expires`, `max_budget`, `models`

On error:
- **401** — check that `LITELLM_API_KEY` is a valid admin key
- **400** — check required fields; verify `team_id`/`user_id` exists
- Other errors — show `detail` and the likely fix

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [BerriAI](https://github.com/BerriAI)
- **Source:** [BerriAI/litellm-skills](https://github.com/BerriAI/litellm-skills)
- **License:** MIT
- **Homepage:** https://github.com/BerriAI/litellm-skills

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-berriai-litellm-skills-add-key
- Seller: https://agentstack.voostack.com/s/berriai
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
