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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# ---------------------------------------------------------------------------
# polyglotmesh configuration
# ---------------------------------------------------------------------------
# This file lives at $POLYGLOTMESH_HOME/config.toml (default: ~/.polyglotmesh/config.toml).
# Run `polyglotmesh where` to print the path on your machine.
# Run `polyglotmesh show` to print the *active* (merged) version.
#
# Field reference mirrors the LiteLLM proxy config.yaml schema for the parts
# most teams use: per-key limits, per-deployment credentials, model aliases,
# routing, and queue / health-check tuning.
# ---------------------------------------------------------------------------
[]
# HTTP bind address for the proxy + admin API.
= "0.0.0.0:8080"
# Optional global cap on in-flight requests across every key.
# global_max_parallel_requests = 200
# Reject request bodies larger than this (MB).
# max_request_size_mb = 64
# ---------------------------------------------------------------------------
# Self-issued API keys
# ---------------------------------------------------------------------------
# Each [[api_keys]] entry is one virtual key. You can put raw tokens (the
# router will hash them at startup) or use the `key` subcommand to generate
# a fresh one. Every limit field is optional; 0 / None = unlimited.
#
# Per-key fields (LiteLLM parity):
# key raw token (hashed in memory)
# key_alias friendly label
# role "api" (default) or "admin"
# models list of model names this key is allowed to call
# allowed_providers ["openai","anthropic"] — empty = both
# rpm_limit requests per minute
# tpm_limit tokens per minute
# max_parallel_requests concurrent cap for this key
# max_budget USD budget (0 = unlimited)
# soft_budget USD — request throttled (not blocked) when crossed
# budget_duration "30s" "5m" "1h" "1d" "7d" "30d" "1w" "1mo"
# expires ISO 8601 timestamp or relative ("7d")
# allowed_model_region region tag the deployment must carry
# blocked bool
[[]]
= "pgm-replace-me-with-`polyglotmesh key`-output"
= "dev-key"
= 60
= 200000
= 5.0
= "1d"
= "30d"
= ["gpt-4o-mini", "claude-3-5-sonnet-20241022"]
# A second key with admin powers, used to call /v1/admin/*.
[[]]
= "pgm-admin-replace-me"
= "ops"
= "admin"
= 0 # unlimited
# Legacy bare-string keys still work (role=api, no limits).
= []
# ---------------------------------------------------------------------------
# Upstream providers
# ---------------------------------------------------------------------------
# [[upstreams]] = one deployment. Add 3-4 of each kind for a real setup.
# Per-upstream fields (LiteLLM litellm_params parity):
# id, kind, base_url, api_key
# priority higher = preferred
# weight weighted-round-robin weight
# models ["gpt-4o-mini", ...] — empty = pass-through
# timeout_ms per-request soft timeout
# max_concurrency 0 = unlimited
# rate_limit_rpm per-upstream request rate cap
# rate_limit_tpm per-upstream token rate cap
# max_budget USD budget for this deployment
# budget_duration reset window for the budget
# region tag for region pinning
# tags tag-based routing labels
# enabled bool
[[]]
= "openai-primary"
= "openai"
= "https://api.openai.com/v1"
= "sk-..."
= 30
= 3
= ["gpt-4o-mini", "gpt-4o"]
= 60000
= 50
= 500
= 200000
= "us"
= ["prod", "fast"]
= 100.0
= "1d"
[[]]
= "openai-fallback"
= "openai"
= "https://api.openrouter.ai/v1"
= "sk-or-..."
= 10
= ["gpt-4o-mini"]
= "us"
= ["fallback"]
[[]]
= "openai-vllm"
= "openai"
= "http://gpu-box.local:8000/v1"
= "EMPTY"
= 5
= 5
= ["gpt-4o-mini"]
= "self-hosted"
= ["local"]
[[]]
= "anthropic-primary"
= "anthropic"
= "https://api.anthropic.com"
= "sk-ant-..."
= 30
= ["claude-3-5-sonnet-20241022", "claude-3-5-haiku-20241022"]
= 60000
= 30
= 200
= "us"
= ["prod"]
[[]]
= "anthropic-bedrock"
= "anthropic"
= "https://bedrock-runtime.us-east-1.amazonaws.com"
= "bedrock-key"
= 15
= ["claude-3-5-sonnet-20241022"]
= "us-east-1"
= ["bedrock"]
# ---------------------------------------------------------------------------
# model_list (LiteLLM-style top-level alias)
# ---------------------------------------------------------------------------
# A bare alias: { "model_name": <exposed>, "upstream_id": <id>, "upstream_model": <optional> }
# This is the simplest way to expose "my-gpt-4o-mini" → upstream `openai-primary` model `gpt-4o-mini`.
[[]]
= "gpt4-mini"
= "openai-primary"
[[]]
= "claude-sonnet"
= "anthropic-primary"
= "claude-3-5-sonnet-20241022"
# ---------------------------------------------------------------------------
# model_aliases (multi-upstream alias, for failover / A-B)
# ---------------------------------------------------------------------------
# A logical model name can map to multiple (upstream_id, upstream_model) pairs;
# the router tries them in the order listed.
[]
= [
{ = "openai-primary", = "gpt-4o-mini" },
{ = "openai-fallback", = "gpt-4o-mini" },
{ = "openai-vllm", = "gpt-4o-mini" },
]
# ---------------------------------------------------------------------------
# Queue / health-check tuning (LiteLLM router_settings parity)
# ---------------------------------------------------------------------------
[]
# Per-provider max in-flight + queued. 0 = unbounded.
= 0
# How long a queued request waits before returning 503.
= 30000
# Background health probe interval (ms). 0 = disable.
= 15000
= 5000
# Consecutive failures before marking an upstream unhealthy.
= 3