Skip to content

Docs/add pgsgrove pricing - #40762

Closed
Phoenix-Grove-Systems wants to merge 41 commits into
BerriAI:mainfrom
Phoenix-Grove-Systems:docs/add-pgsgrove-pricing
Closed

Phoenix-Grove-Systems wants to merge 41 commits into
BerriAI:mainfrom
Phoenix-Grove-Systems:docs/add-pgsgrove-pricing

Conversation

@Phoenix-Grove-Systems

Copy link
Copy Markdown

TLDR

Problem this solves:

  • ...

How it solves it:

  • ...

User Flow

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Caveats (if any)

QA runbook

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

mateo-berri and others added 30 commits September 10, 2026 19:13
…egacy flash aliases at Flash rates

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
An open breaker raised a generic Exception on every skipped call, and DualCache caught
it and logged a full ERROR traceback each time. Under load that became hundreds of
traceback formats per second on every replica and pinned the proxies at 100% CPU.

Raise a typed RedisCircuitBreakerOpenError instead and have DualCache return its
in-memory result without logging for it. Classify redis-py pool exhaustion
(ConnectionError chained from TimeoutError) as a timeout so a latency blip goes
through the duration gate. Track a breaker generation so a call admitted before the
breaker opened cannot close it, leaving that to the HALF_OPEN probe. Rate limit the
LoggingWorker callback-error traceback to one per interval so a stalled logging
backend cannot start a second traceback storm.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…date, not a cost tracking failure

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nstead of per request warning

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…timeout check

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…r quiet when the breaker is open

The sync RedisCache.get_cache ran outside the breaker and logged with a stray positional
argument, so every failure printed a logging-module stack dump. Cache.add_cache and its
async twins logged a full traceback for the expected open-breaker fast fail

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…le worker tracebacks per error type

Swallowed failures are now reported to the breaker when the admitted call exits, so a
call admitted before the breaker opened cannot refresh the open timer or knock out the
recovery probe. The sync batch read raises the typed open-breaker error like its async
twin so DualCache releases its batch reservations, and LoggingWorker throttles tracebacks
per exception class instead of worker-wide

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…rded call swallowed

batch_cache_write flushes through async_set_cache_pipeline, both guarded. The inner
guard consumed the swallowed pipeline failure and the outer then recorded a success,
so a dead Redis never tripped the breaker on the batch write path. Only the outermost
admission now reports, and the sync batch read runs under the same guard.

Also covers the sync add_cache and embedding pipeline wrappers, the increment pipeline,
sadd, and the stale raise path in tests.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…en_silent_miss

Take the staging tree outright. BerriAI#40620 already landed the typed
RedisCircuitBreakerOpenError, DEBUG-level refusal logging at every
DualCache, Cache, limiter, and router catch site, and sync timeout
classification, so the overlapping parts of this branch are superseded.
The pieces that are still missing on staging are rebuilt on top in the
next commit
…ad and spend counter paths

The sync get path was unguarded, logged with a stray format argument, and never fed the
breaker. The sync batch read swallowed the breaker's refusal as an ERROR plus a service
failure event per call, so DualCache dropped its in-memory hits and left batch reservations
behind. record_success closed an OPEN breaker on stale in-flight successes, skipping the
recovery timeout and the half-open probe. The spend counter pipeline re-raised the refusal
into the cost callback, which logged an ERROR and fired the failed-tracking alert per request.
…th state cache

The sync Redis read now raises while the circuit breaker is open, and the
health state merge caught that as a generic error, skipping the local write
and logging an error on every background health check cycle. Read the shared
snapshot through a helper that treats the refused read as a miss so the merge
falls back to the pod-local copy the way a swallowed connection error already did
…aker

A call admitted before the breaker opened could finish while the breaker was
HALF_OPEN and close it before the designated probe reported, so Redis traffic
resumed on a stale answer. The admission now records whether the call is the
probe and only the probe's success closes a half-open breaker.

The cron job lock manager also logged an error every cycle the open breaker
refused its Redis call, one line per job per pod. That refusal is now a debug
line like every other guarded call, while real Redis errors still log at error
The provider budget push runs inside the request success callback, so
awaiting the Redis pipeline there made every request wait for the round
trip. Hand it back to a task whose failure is logged through the breaker
aware logger, so an open breaker stays a debug line and a real Redis error
is one error line instead of an unretrieved task traceback
…pen_silent_miss

fix(caching): keep an open Redis circuit breaker open and quiet on the sync read and spend counter paths
…dcr_7449

fix(mcp): accept VS Code OAuth registration callbacks
…_health_4896

fix(mcp): check OpenAPI specifications without native MCP handshakes
mateo-berri and others added 11 commits September 11, 2026 13:14
…ash vision, perplexity nemotron reasoning

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…q deprecation dates

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…BerriAI#40713)

Key objects share the 200-entry UserApiKeyCache in-memory store with teams,
end users, tags and memberships, so churn in those objects evicts hot keys
and forces a LiteLLM_VerificationToken lookup on the next request. Route
bare hashed-token keys to a dedicated InMemoryCache inside UserApiKeyCache
while keeping Redis, TTL, serialization and invalidation shared

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… buffering the whole response (BerriAI#40724)

* fix(passthrough): parse Bedrock stream spend incrementally instead of buffering the whole response

Bedrock pass-through streaming kept every relayed chunk in memory until EOF and
then decoded, parsed and translated the whole stream again for spend logging.
Large or concurrent streams could exhaust proxy worker memory.

Sync and async passthrough wrappers now hand each chunk to a provider stream
collector as it is relayed. Bedrock decodes event-stream frames incrementally,
folds consecutive text deltas, and keeps only what stream_chunk_builder needs
for usage, tool calls and metadata. Text deltas are no longer retained in the
Bedrock and Anthropic stream decoders either. Providers without a collector
keep the previous raw-bytes behavior. Collector failures are isolated so spend
tracking can never interrupt the customer stream

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(passthrough): assert the spend payload the collector builds instead of mock internals

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(passthrough): type the Bedrock collector helpers by the collector protocol instead of asserting the class

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…eys stored in AWS Secrets Manager (BerriAI#40475)

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
BerriAI#40725)

* feat(proxy): make the in-memory management cache capacity configurable

Add general_settings.user_api_key_cache_max_size (positive int, default 200) to resize the
in-memory tier of the shared user_api_key_cache at startup and on DB config reloads, expose it
in the Admin UI general settings, and cover it with behavioral tests. Prior art: BerriAI#34726

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(caching): resize the in-memory tier from DualCache so any cache instance honours the cap

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* style(proxy): wrap the cache capacity field description to the 120 col limit

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…AI#40687)

Starlette scans the route table in registration order, so a request pays one
regex match per route registered ahead of its own. The proxy registers several
hundred routes and left the liveness probe near position 280 and the lazy
loaded /v1/messages at the very end. Move /health/liveliness, /health/liveness,
/v1/chat/completions, /chat/completions and /v1/messages to the front of the
route table after startup registration and again after a lazy router loads.

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
BerriAI#40663)

The docstring cited session_affinity_ttl_seconds as the keepalive bound,
but the Router-level knob feeding ttl_seconds is
deployment_affinity_ttl_seconds; session_affinity_ttl_seconds is the
separate per-request PreRoutingHookResponse override. Anyone grepping
the docstring's name to shrink the Router default finds only the
override. Name both, scoped correctly.
Adds Phoenix Grove's public catalog (19 chat models, 33 entries including
-turbo priority-lane variants, plus 1 embedding model) to
model_prices_and_context_window.json with per-token input/output/cache-read
costs, context windows, max output and capability flags. The backup copy is
updated byte-for-byte; the generated schema is unchanged (no new fields).

Source: https://api.pgsgrove.com/docs/usage-rates

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Sep 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
4 out of 5 committers have signed the CLA.

✅ joshua-berri
✅ mateo-berri
✅ Phoenix-Grove-Systems
✅ anmolg1997
❌ devin-ai-integration[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@codspeed

codspeed Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing Phoenix-Grove-Systems:docs/add-pgsgrove-pricing (730fd00) with main (362033c)

Open in CodSpeed

@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds pricing and capability metadata for PGS Grove models while also incorporating cache, passthrough streaming, Redis resilience, routing, MCP health-check, and proxy-loading changes

  • Adds PGS Grove model catalog entries
  • Splits virtual-key objects into a dedicated authentication-cache partition
  • Incrementally collects Bedrock passthrough streams for spend logging
  • Adds bounded OpenAPI health probes and lazy passthrough routing
  • Hardens Redis circuit-breaker and shared-state behavior

Confidence Score: 4/5

The PR is not ready to merge because the newly advertised PGS Grove models cannot resolve to a registered provider

Provider-prefixed PGS Grove requests fail before upstream execution, and the authentication-cache sizing option also leaves virtual-key capacity unchanged

Files Needing Attention: model_prices_and_context_window.json, litellm/proxy/_types.py, litellm/proxy/common_utils/user_api_key_cache.py

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds PGS Grove pricing under an unregistered provider slug, preventing normal prefixed-model resolution
litellm/proxy/common_utils/user_api_key_cache.py Splits virtual-key objects into a dedicated cache but does not propagate the new capacity setting to it
litellm/passthrough/main.py Replaces raw stream buffering with provider collectors while preserving relay behavior on accounting failures
litellm/llms/bedrock/passthrough/transformation.py Adds incremental Bedrock event-stream decoding and text-delta coalescing for spend tracking
litellm/proxy/_lazy_features.py Adds reserved route slots and deterministic registration order for lazily loaded passthrough routes
litellm/caching/redis_cache.py Prevents stale successes from closing a newer circuit-breaker generation and guards synchronous reads

Reviews (1): Last reviewed commit: "docs: add Phoenix Grove (pgsgrove) model..." | Re-trigger Greptile

"supports_response_schema": true,
"supports_vision": false
},
"pgsgrove/glm-5.2": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Unregistered provider prefix

Requests using the new pgsgrove/... entries cannot resolve pgsgrove to a registered provider, so they fail before reaching the advertised models

Knowledge Base Used: Provider adapters and capabilities

Comment thread litellm/proxy/_types.py
Comment on lines +2605 to +2613
user_api_key_cache_max_size: int | None = Field(
None,
gt=0,
description=(
"max number of entries (virtual keys, teams, users, end users, memberships, ...) each worker keeps in "
"its in-memory auth cache. Defaults to 200. Raise this if you have more active keys than that or auth "
"lookups keep hitting the DB"
),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Virtual keys ignore limit

This setting resizes only the general cache partition. Virtual-key objects remain capped at 200, causing continued evictions and database lookups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants