Files
prose-contracts/litellm-api-keys.prose.md
T
root 895858c60a feat: LiteLLM API key management contract + longevity policy
- New contract: litellm-api-keys.prose.md — create/rotate/verify named API keys
- Renamed tanko key alias from tanko-jul2026 to tanko (bare name)
- Added Key Longevity Policy: permanent keys (duration:null), event-driven rotation
- Added default_key_generate_params to litellm config (permanent + 00 budget)
- Updated hermes-key-enforcement verified agents table for 2026-07-04
2026-07-04 22:48:48 +00:00

2.6 KiB

kind, name, description
kind name description
function litellm-api-keys Manages LiteLLM API keys for agent identity. Creates named keys so each agent is identifiable in LiteLLM logs/spend tracking. Keys are permanent (no expiry) and use the agent's bare name as alias (e.g., "tanko", not "tanko-jul2026"). Ensures agents never use the master key directly. Rotation is event-driven, not calendar-driven — rotate only on compromise, personnel change, or periodic security hygiene (quarterly/annually).

Parameters

  • agent_name: string — The agent to manage keys for (e.g., "tanko", "mumuni")
  • action: "create" | "rotate" | "verify" | "list" — What to do (default: "create")
  • litellm_host: string — LiteLLM admin endpoint (default: "192.168.68.116:4000")
  • master_key: string — LiteLLM master key (default from environment)
  • agent_host: string — Agent's IP for SSH (default: resolved from infra)
  • agent_user: string — SSH user (default: "jerome")

Returns

  • action: string — What was done
  • key_alias: string — The LiteLLM key alias created/rotated
  • key_prefix: string — First 10 chars of the new key (for identification)
  • previous_key_alias: string | null — Previous key alias if rotating
  • litellm_response: object — Raw response from LiteLLM /key/generate
  • agent_config_updated: boolean — Whether /etc/environment was updated
  • verification: { status: string, detail: string } — Final health check

Execution

  1. Authenticate — Verify master_key works against LiteLLM /key/list
  2. Check existing keys — List all keys, find any with agent_name alias
  3. If action == "list": Return all keys with their aliases and spend
  4. If action == "create":
    • Generate new key with key_alias: "{agent_name}" (e.g., "tanko" — bare name, no date)
    • Set metadata: { "agent": "{agent_name}", "purpose": "agent-inference" }
    • Duration is null (permanent) — inherited from litellm default_key_generate_params
    • Set models: ["syslog-auto", "qwen3.6-35B-A3B", "qwen3.6-27B-code", "gemma-4-12b"]
    • Return the new key
  5. If action == "rotate":
    • Generate new key with same alias (LiteLLM replaces the old key)
    • SSH to agent_host, update /etc/environment LITELLM_API_KEY
    • Restart agent gateway (hermes gateway restart for Hermes agents)
    • Verify: curl test against /v1/models with new key
    • Rotation policy: on-demand only (compromise, departure, quarterly hygiene)
  6. If action == "verify":
    • SSH to agent, read /etc/environment
    • Test the key against LiteLLM /v1/models
    • Confirm key alias matches agent_name in LiteLLM key list