-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlitellm_config.yaml
More file actions
171 lines (158 loc) · 8.25 KB
/
Copy pathlitellm_config.yaml
File metadata and controls
171 lines (158 loc) · 8.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# LiteLLM Proxy Server config — routes through the blockrun-litellm sidecar.
#
# 1) Start the sidecar with ONE credential:
# blockrun-litellm-proxy --port 4001 --api-key brk_live_... # account credit
# or, to pay per call from an x402 wallet (Solana is the default chain):
# export SOLANA_WALLET_KEY=YOUR_SOLANA_PRIVATE_KEY
# blockrun-litellm-proxy --port 4001
#
# 2) Start LiteLLM Proxy with this file:
# litellm --config litellm_config.yaml --port 4000
#
# 3) Test:
# curl http://localhost:4000/v1/chat/completions \
# -H "Content-Type: application/json" \
# -d '{"model": "gpt-5.6-terra", "messages": [{"role":"user","content":"Hi"}]}'
#
# Note: the model string takes the form `openai/<blockrun-model-id>` so LiteLLM
# treats our proxy as a generic OpenAI-compatible endpoint and forwards the
# inner provider prefix (e.g. "openai/", "anthropic/", "google/") verbatim.
#
# ──────────────────────────────────────────────────────────────────────────
# ⚠️ COST / SPEND TRACKING — REQUIRED for budgets to mean anything
# ──────────────────────────────────────────────────────────────────────────
# LiteLLM computes per-call spend (and enforces team/key budgets like
# `max_budget`) from `input_cost_per_token` × prompt_tokens +
# `output_cost_per_token` × completion_tokens. The blockrun model ids
# (`anthropic/claude-opus-4.8`, `openai/gpt-5.5`, …) are NOT in LiteLLM's
# built-in `model_cost` map, so WITHOUT the explicit `*_cost_per_token` values
# below LiteLLM prices these calls at $0 — a key/team `max_budget` (e.g. $200)
# then NEVER trips and the dashboard under-reports spend.
#
# The values below are each provider's official LIST price (what BlockRun's
# gateway also bills, 1:1) converted to $/token ($X per 1M ÷ 1e6). The sidecar
# forwards the gateway's REAL upstream token counts, so cost = list price ×
# actual tokens. Keep these in sync with the gateway's price table; update when
# a model's list price changes.
#
# ACCURACY CAVEATS — this view is for BUDGET ENFORCEMENT. The gateway-side
# reconciliation report (blockrun-sol /api/internal/reconciliation) is the
# EXACT cost source of truth, including prompt-cache discounts:
# • Prompt-cache pricing: `cache_read_input_token_cost` /
# `cache_creation_input_token_cost` in litellm_params are honored only on
# newer LiteLLM versions. On older proxies (e.g. 1.70.0) these keys are
# SILENTLY DROPPED and cache tokens are priced at the full
# `input_cost_per_token` — a CONSERVATIVE over-count of cache reads (the
# budget trips earlier, never later). Verify your proxy version, or rely on
# the reconciliation report for exact cost.
# • Streaming spend is exact only if the gateway emits a final usage frame in
# the SSE stream; otherwise LiteLLM falls back to tiktoken ESTIMATES.
# Non-streaming always prices off the gateway's real usage block.
# ──────────────────────────────────────────────────────────────────────────
model_list:
- model_name: gpt-5.6-terra
litellm_params:
model: openai/openai/gpt-5.6-terra
api_base: http://localhost:4001/v1
api_key: "dummy" # unused unless BLOCKRUN_PROXY_TOKEN is set on the sidecar
input_cost_per_token: 0.0000025 # $2.50 / 1M
output_cost_per_token: 0.000015 # $15 / 1M
- model_name: claude-opus-5
litellm_params:
model: openai/anthropic/claude-opus-5
api_base: http://localhost:4001/v1
api_key: "dummy"
input_cost_per_token: 0.000005 # $5 / 1M
output_cost_per_token: 0.000025 # $25 / 1M
cache_read_input_token_cost: 0.0000005 # $0.50 / 1M
cache_creation_input_token_cost: 0.00000625 # $6.25 / 1M
- model_name: gpt-5-mini
litellm_params:
model: openai/openai/gpt-5-mini
api_base: http://localhost:4001/v1
api_key: "dummy"
input_cost_per_token: 0.00000025 # $0.25 / 1M
output_cost_per_token: 0.000002 # $2 / 1M
- model_name: claude-fable-5
litellm_params:
model: openai/anthropic/claude-fable-5
api_base: http://localhost:4001/v1
api_key: "dummy"
# claude-fable-5 is redirected to Opus 4.8 upstream; price at Opus 4.8.
input_cost_per_token: 0.000005 # $5 / 1M
output_cost_per_token: 0.000025 # $25 / 1M
cache_read_input_token_cost: 0.0000005 # $0.50 / 1M (0.1x input)
cache_creation_input_token_cost: 0.00000625 # $6.25 / 1M (1.25x input)
- model_name: claude-haiku-4-5
litellm_params:
model: openai/anthropic/claude-haiku-4-5
api_base: http://localhost:4001/v1
api_key: "dummy"
input_cost_per_token: 0.000001 # $1 / 1M
output_cost_per_token: 0.000005 # $5 / 1M
cache_read_input_token_cost: 0.0000001 # $0.10 / 1M
cache_creation_input_token_cost: 0.00000125 # $1.25 / 1M
- model_name: gemini-3.1-pro
litellm_params:
model: openai/google/gemini-3.1-pro
api_base: http://localhost:4001/v1
api_key: "dummy"
input_cost_per_token: 0.000002 # $2 / 1M
output_cost_per_token: 0.000012 # $12 / 1M
# ── Image / video models ────────────────────────────────────────────────
# Media models are NOT in LiteLLM's price map either. Images bill as
# `input_cost_per_pixel × width × height × n` (flat per-image price ÷
# 1024×1024 = 1048576); video bills as `output_cost_per_second × seconds` —
# always pass `seconds` on POST /v1/videos or the call is priced $0.
# Video routes through the sidecar's OpenAI-compatible Videos API
# (POST /videos → poll GET /videos/{id} → GET /videos/{id}/content),
# available since blockrun-litellm 0.6.0.
- model_name: grok-imagine-image
litellm_params:
model: openai/xai/grok-imagine-image
api_base: http://localhost:4001/v1
api_key: "dummy"
input_cost_per_pixel: 1.9073486328125e-08 # $0.02/image ÷ 1048576 px
model_info:
mode: image_generation
- model_name: grok-imagine-image-pro
litellm_params:
model: openai/xai/grok-imagine-image-pro
api_base: http://localhost:4001/v1
api_key: "dummy"
input_cost_per_pixel: 6.67572021484375e-08 # $0.07/image ÷ 1048576 px
model_info:
mode: image_generation
- model_name: grok-imagine-video
litellm_params:
model: openai/xai/grok-imagine-video
api_base: http://localhost:4001/v1
api_key: "dummy"
output_cost_per_second: 0.05 # $0.05/second
model_info:
mode: video_generation
# Wildcard fallback — any BlockRun model id passed as the model name will be
# forwarded as-is. Useful if your app already speaks BlockRun model names.
# ⚠️ Calls matched by this wildcard are NOT priced (no per-token cost), so
# they contribute $0 to spend/budgets. Add an explicit model_list entry with
# `input_cost_per_token`/`output_cost_per_token` for any model you want
# counted against a budget.
- model_name: blockrun/*
litellm_params:
model: openai/*
api_base: http://localhost:4001/v1
api_key: "dummy"
litellm_settings:
# BlockRun ignores most OpenAI tuning knobs (frequency_penalty, etc.) —
# let LiteLLM drop them silently instead of warning on every request.
drop_params: True
# Exact chat spend, no callback needed: since blockrun-litellm 0.6.0 the
# sidecar returns the real settled x402 charge in the
# `x-litellm-response-cost` response header, which LiteLLM reads off
# openai-compatible upstreams and uses as `response_cost` directly (it
# overrides the per-token estimate above when present). The per-model
# `*_cost_per_token` values remain as the fallback for LiteLLM versions or
# call paths that don't capture upstream headers.
general_settings:
# Bind LiteLLM Proxy here; clients talk to LiteLLM, LiteLLM talks to our sidecar.
master_key: "sk-litellm-master-key-change-me"