litellm/tests/unit/llms
maciej-berri 88ec522942
feat(messages): serve vertex ai claude messages on rust only (#52314)
* feat(python-compat): port urllib.parse urlsplit, urlparse and urlunparse

* fix(vertex_ai): shape Claude Messages requests like Python (auth header, betas, output_format, URL)

* test(vertex_ai): stub the Google token in Messages route tests

* fix(vertex_ai): attribute the anthropic-version refusal to the provider and model

* test(vertex_ai): parity cases for Claude Messages request shaping

* docs(vertex_ai): record the Messages shaping rules

* feat(vertex_ai): classify GCP credential failures by the stage that failed

* fix(vertex_ai): raise Python's Google auth exception classes for native credential failures

Map Rust's GCP credential-acquisition stage to the exception Python's
vertex token path raises (RefreshError, TransportError,
DefaultCredentialsError, ValueError) and name Vertex's default host in
transport failures without an api_base. Read only for vertex_ai.

* fix(vertex_ai): name the unreadable credentials file as Python does and add vertex credential parity cases

* test(vertex_ai): build the SDK token rejection without a reqwest client

* fix(vertex_ai): port request labels, regional cost location and beta-gated field stripping to Rust Messages

* test(vertex_ai): satisfy clippy in the labels tests

* test(vertex_ai): parity cases for request labels, regional cost and beta-gated fields

* test(vertex_ai): name the unreserved label fields case for what it checks

* test(vertex_ai): parity case for the regional uplift on a proxy-built logging object

* test(vertex_ai): keep only regional cost cases that reproduce the proxy logging gap

* feat(vertex_ai): add a Vertex Messages-only GCP login matching Python's load_auth

* fix(vertex_ai): log Vertex Messages in before building its URL, like Python's load_auth

* test(vertex_ai): route Vertex Messages by the model's supported regions

* test(vertex_ai): mark Google login failures for the Python route

* test(vertex_ai): parity cases for the Vertex Messages login

* fix(vertex_ai): send Vertex metadata and Resource Manager lookups through the shared HTTP pool

* fix(vertex_ai): refresh Vertex Messages authorized users at Google's token endpoint like google-auth

* fix(vertex_ai): map Vertex Messages login failures through one marker

Rust now names the exception class, text and any credentials file for every
Vertex Messages login failure, and the host raises it. The stage marker,
its classifier and the vertex_failures module are gone. A credentials file
failure goes through Python's own raise_vertex_credentials_failure, so its
log names the path and the reason. A host without google-auth fails the
login with Python's ImportError.

A vertex_location with one trailing newline is accepted, as Python's
regex accepts it. The URL it builds is refused the way httpx refuses it,
so the call never leaves the process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* feat(vertex_ai): log Vertex Messages in with external account authorized user ADC

google-cloud-auth has no builder for these workforce identity credentials,
so this ports google-auth's: the file loads only when it holds a valid token
or the fields to refresh one, and the refresh token is exchanged at the
file's token_url with basic client auth. A refused refresh raises the
OAuthError google-auth raises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* feat(vertex_ai): cache vertex messages tokens per key-file version

Mint service-account tokens natively, keep tokens until google-auth
calls them stale, refresh stale tokens once in the background, refresh
expired ones single-flight, reload once on invalid_grant, and keep the
earlier key file's credentials when a replacement does not load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* test(vertex_ai): cover vertex messages key-file rotation, fallback and reauth

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): send vertex messages service-account grants as google-auth does

Sign the assertion over json.dumps of google-auth's header and claims,
put assertion before grant_type in the form, and send accept: */*.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): log vertex messages credential load failures as python does

Log load_auth failures and failed reauthentication retries on the
LiteLLM logger with Python's text, for the Vertex AI Messages login only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): warn when vertex messages drops disabled thinking

Python warns when it omits thinking={'type': 'disabled'} for an
always-on-thinking model. Warn on the Vertex AI route only; the native
Anthropic route stays silent, as it is on main. Parity cases now compare
warnings for the disabled-thinking drop and the missing-project login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* style(rust_bridge): suppress the cast ban on the cast import itself

* refactor(http): share python requests' proxy and CA bundle rules

Move the azure_ai token transport's reading of HTTPS_PROXY/NO_PROXY and
REQUESTS_CA_BUNDLE/CURL_CA_BUNDLE into litellm-http so the Vertex AI
Messages login can reuse it. Azure behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): mint vertex messages tokens natively as google-auth does

- Send every token request through python requests' proxy and CA
  bundle rules, verifying against the host's certifi bundle by default.
- Exchange external accounts (file, url, executable, AWS metadata and
  explicit AWS) at STS natively, reading only access_token and
  expires_in; a missing token refreshes once more, then raises
  main's ValueError.
- Refresh authorized users with google-auth's form post.
- Raise Python's AttributeError/TypeError crashes for non-dict JSON.
- Keep one login cache per model, as Python's per-model config does.
- Warn when a model's supported_regions override the location.
- Word a TLS close before headers as a disconnect, for vertex_ai only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* refactor(vertex_ai): stop replaying python helpers for vertex messages failures

- Rust writes the unsendable-URL message; the host raises InvalidURL
  with it instead of parsing the URL through httpx.
- Rust logs a credentials file failure's path and reason; the host
  raises the file-failure ValueError Rust names.
- A connect failure carries the origin Rust sent it to; the host names
  that host instead of recomputing the Vertex base.
- The service-account JWT is built from serde structs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* refactor(vertex_ai): read credential truthiness through python-compat

Replace the vertex messages loader's local truthiness helpers with one
json_truthy in python-compat, called where credential JSON is read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* refactor(vertex_ai): raise plain typed failures for bad vertex messages credentials

Owner ruling on review #8: stop imitating Python crash classes and
repr texts. Unusable credentials raise ValueError or google-auth's
DefaultCredentialsError/MalformedError/InvalidResource, and unreadable
token replies raise RefreshError, all with plain messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* refactor(vertex_ai): build the vertex messages url without the urllib port

Owner ruling on review #10: split a custom api_base into origin, path,
query and fragment with a narrow builder instead of python-compat's
urlsplit/urlparse/urlunparse port, which nothing else used and is
removed with its fixtures. URLs match Python's for every normal base
(checked against a Python-generated table); ;params bases differ, as
approved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* refactor(vertex_ai): drop the google-auth import check from vertex messages

Owner ruling on review #3: the native login never needs google-auth, so
a Vertex AI Messages call no longer imports it to raise Python's
ImportError when it is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): refuse a vertex location with a trailing newline at validation

Owner ruling on review #2: stop copying re's $-before-newline quirk. A
location with a trailing newline gets litellm's 'Invalid vertex_location
format' ValueError, where Python fails later with InvalidURL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* refactor(vertex_ai): parse the caller's vertex labels header with serde_json

Owner ruling on review #12: the X-Vertex-AI-Labels JSON is read with
serde_json (preserve_order) instead of python_json::loads, so NaN or
Infinity makes the header invalid and its labels are skipped. The header
sent to Google keeps Python's json.dumps spacing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* feat(messages): serve vertex ai claude messages on rust only

vertex_ai Messages calls whose model Python's partner config serves as
Claude now run on Rust with no flag and no Python fallback. Gemini,
Llama, Mistral, other partner models and Messages passthrough keep their
Python targets. The parity suite drops its preview rule, so the real
catalog decides, and the vertex safeguards contract no longer asserts
Python routing.

* chore(rust): refresh cargo lock after rebase

* refactor(vertex_ai): parse vertex credentials and token replies into typed structs

Credentials files, token endpoint replies, executable answers and the
request label config are deserialized once into typed structs, so the
login code no longer passes serde_json values around or prints them the
way Python's str() would. A credentials field of an unexpected JSON type
is now refused when the file is read.

* refactor(vertex_ai): say rust instead of native for the vertex messages port

* refactor(vertex_ai): move the python compat helpers into python-compat

The or-chain over credential sources, urllib's quote safe set, urlsplit,
the validating base64 decoder, unicodedata categories and the JSON type
name now live in python-compat, and the vertex code calls them where it
reads loose input.

* refactor(vertex_ai): word vertex login failures and logs in litellm's own terms

Login failures keep the exception class Python raises but no longer copy
google-auth's and requests' text. Whether a refused refresh reloads the
credentials now comes from the token endpoint's parsed error field, not
from searching the failure text. The credential and region logs keep
their level with Rust wording.

* docs(vertex_ai): document the vertex messages login files and structs

* refactor(vertex_ai): raise vertex login failures from a fixed allowlist of classes

The host no longer looks a google.auth exception up by whatever name Rust
sends. It raises one of the classes Rust's login can name and leaves any
other name to the usual failure mapping.

* test(vertex_ai): compare rust-worded vertex login failures by class and status

* test(vertex_ai): capture the python vertex messages parity legs as fixtures

The vertex parity groups now compare Rust against the Python leg captured
once through MESSAGES_PARITY_DUMP, with ports and temporary directories
written as placeholders, so the Python request path can go.

* refactor(vertex_ai): drop the python vertex messages request path now served by rust

* docs(vertex_ai): note that a caller authorization header reaches the provider beside the minted token

* docs(vertex_ai): note the kept /v1 doubling for custom vertex api_base

* refactor(vertex_ai): write the vertex labels header with serde_json

* refactor(messages): raise connection failures with litellm's own text naming the host

Drop messages_sent_origin and the host code that rebuilt aiohttp/httpx connection-error text from
Python's SSL config. The Connect error now names the host (never the rest of the URL) it could not
reach; class and status are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): read at most the size limit of a vertex_credentials file

Read one byte past the 4-byte-per-character bound, so /dev/zero or a huge file is refused without
reading it all, and load the source on a blocking thread off the async runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* perf(vertex_ai): dedupe request labels in linear time

Track seen keys in a HashSet and stop once the 32 labels Vertex AI keeps are found, keeping
first-occurrence order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): redact secrets in the Debug of credentials types

Derive veil::Redact on the service account, authorized user, external account (and its AWS keys,
client secret, source headers and executable response), external authorized user and token reply
types, and redact SdkJson as a whole, per the rust-redaction skill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(messages): refuse a URL with a control character only for vertex_ai

anthropic, azure_ai and bedrock send such a URL as reqwest cleans it, as on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* chore(vertex_ai): review nits

Make the unreachable GcpAccessToken arm in resolve_auth an error, fix the google login marker doc,
drop dated ruling references from comments and describe urlsplit in the urllib module doc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): log a credentials file failure from the blocking read

load_vertex_credentials_source runs on a spawn_blocking thread, where the call's logger is not the
default, so the file's path and problem never reached LiteLLM's log. Run it under the caller's
dispatcher and span.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(vertex_ai): replace a labels header Python cannot encode instead of failing

With vertex_request_label_fields set, the proxy replaces every caller X-Vertex-AI-Labels, so Python
never encodes the caller's value and the call succeeds. The host's ASCII check held such a value back
first and failed the call with 'ascii' codec can't encode. For vertex_ai with label fields set, the
check now leaves the labels header to the replacement (dropping a value that is not text). Unset,
the header is still held back and fails as on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* chore(vertex_ai): use main's python-compat type_name after the rebase

main added json::type_name and imports it in thinking.rs, so the branch's copies of the same helper
go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bne5zQXAS7BUJoh6pGX7NQ

* fix(rust): default vertex shaping in gateway router deployments

* fix(auth-gcp): bound vertex subject-token file reads

Read external-account subject-token files and executable output files through one shared helper that caps the read at MAX_CREDENTIALS_FILE_BYTES + 1 on a blocking thread, so /dev/zero is refused by its size and a FIFO no longer blocks a tokio worker. An over-size file is a RefreshError.

* fix(auth-gcp): sign vertex service-account assertions with ring

Sign the RS256 JWT bearer assertion with ring's RsaKeyPair (RSA_PKCS1_SHA256) instead of jsonwebtoken's rust_crypto backend, which pulls in rsa 0.9 (RUSTSEC-2023-0071). PKCS#8 and PKCS#1 PEM keys are still accepted, and a fixed-key test pins the assertion byte-for-byte to the one jsonwebtoken produced. Drops jsonwebtoken, rand and rsa from auth-gcp.

* fix(auth-gcp): keep IAM access tokens out of malformed-reply errors

* fix(auth-gcp): keep credential executable output out of errors

* test(vertex): store captured Python parity fixtures as compact JSON

* refactor(rust_bridge): share one native messages rule for anthropic, azure_ai and vertex_ai

azure_ai and vertex_ai serve native Messages only for Claude, so the rule now
requires Rust only for the Messages target. A call whose target cannot be
computed no longer refuses a non-Claude azure_ai model that Python serves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(auth-gcp): log Vertex Messages in through google_cloud_auth and the shared loader

Claude on Vertex /v1/messages now builds every credential kind with Google's
Rust SDK through the shared GcpAuth loader instead of a hand-written login.

- identity.rs: additive SdkCredentials builder (service account, authorized
  user with a fixed token_uri, external account, impersonated, programmatic,
  impersonated-from, metadata), keyed loads, eviction on a non-transient
  token failure, and a key-file cache key that follows inode, mtime and size.
  The loader traits, GcpAuth::default and NativeProviderLoader are unchanged.
- Service accounts use the SDK's self-signed JWT; a missing private_key_id or
  project_id is filled with an empty string; PKCS#1 keys fail as ValueError.
- explicit_aws.rs keeps litellm's own aws_* login as an SDK subject token
  provider; AWS metadata, file, URL and executable sources go to the SDK.
- compat_certificate_source.rs and compat_external_account_authorized_user.rs
  are small backwards-compat logins for what the SDK lacks.
- SDK failures map to google-auth's exception class per category; a TLS
  certificate failure with only REQUESTS_CA_BUNDLE/CURL_CA_BUNDLE set says to
  set SSL_CERT_FILE.
- Deleted the hand-written service account, authorized user, external account,
  AWS metadata, token cache, requests transport and certifi plumbing, the
  per-model cache and the ring dependency.

* test(parity): treat the service account's self-signed JWT as an approved difference

Owner ruling Q1: Rust signs a service account's token itself with Google's
Rust SDK instead of minting one at token_uri. The Vertex fixture comparison
reads a parity service account's JWT bearer as the token Python's parity
token endpoint granted, and the case pinning an unreachable service account
token_uri is removed with its fixture, since that endpoint is never called.

* fix(auth-gcp): keep Google SDK error text out of Vertex login failures

* fix(auth-gcp): restore the vertex credential failure error log

Python's _load_auth_or_earlier_key_file logs "Failed to load vertex
credentials. Check to see if credentials containing partial/invalid
information. Error: ..." on every load_auth failure, and the proxy's
health check looks for that text. The log went away with logins.rs.

VertexMessagesAuth::login now logs it when the credentials do not load,
when the first token of freshly loaded credentials fails, and when the
project does not resolve. Only the login failure's own message follows
"Error:", and the two failures that still quoted Google SDK build errors
now use the fixed unloadable-credentials message.

* fix(auth-gcp): resolve oidc/ web identity tokens for Vertex explicit AWS keys

Claude on Vertex /v1/messages built the explicit AWS login from an
external_account file's aws_* keys with an AwsAuthService that had no
web identity token source, so aws_web_identity_token: "oidc/..." was
sent to AWS STS as the literal reference. VertexMessagesAuth now takes
the AwsAuthService the Python bridge already wires to the host secrets
for Bedrock (with_aws), so the reference is resolved as Python's
get_secret resolves it.

* fix(auth-gcp): retry the Vertex metadata server ping and project lookup as google-auth does

The GCE metadata ping is tried up to 3 times when the server cannot be
reached, and the project lookup up to 5 times on transport errors or
retryable statuses (408, 429, 500, 503, 504), waiting 1s and doubling
between tries, as google-auth's _metadata.ping and _metadata.get do.

* fix(auth-gcp): gather Vertex backwards-compat logins in vertex_messages/legacy

Move the certificate source, external_account_authorized_user refresh and
their shared token helper into vertex_messages/legacy, reached through a
small interface in legacy/mod.rs.

Add legacy/executable_source.rs: credential helper executables run as
google-auth's pluggable.py runs them (GOOGLE_EXTERNAL_ACCOUNT_* variables,
shell-style split with shlex, timeout_millis, a cached output_file read
under the credentials file size cap), with the subject token handed to
the SDK's ProgrammaticBuilder. Errors never carry the helper's output.

Add legacy/impersonation.rs: an impersonation URL off the SDK's default
host (Private Service Connect, other universes) is called directly with
the STS token, as google-auth does; the default host stays with the SDK.
The explicit AWS path passes universe_domain through.

Add bounded_file_source.rs: file-sourced subject tokens are read with the
capped spawn_blocking reader instead of the SDK's unbounded synchronous
read_to_string.

* fix(auth-gcp): keep the earlier Vertex key file credentials when a rewrite fails to load

When a vertex_credentials or ADC key file is rewritten and the new
contents do not load, log the credential failure and keep serving the
credentials that path loaded last, as Python does. A path that never
loaded fails as before. Other shared-loader callers are unchanged.

* fix(messages): keep main's connect-origin failure text after the merge

The merge of main kept this branch's older removal of the connect-failure
text rebuild (0f0a55fd2e), which changed Bedrock and Mantle error text.
Restore main's connect_origin chain (http, llms, inference, python-bridge)
and the host's aiohttp/httpx text rebuild unchanged for every provider.
Vertex follows main's design: without an api_base it keeps Rust's text.

* fix(auth-gcp): accept PKCS#1 service account keys for Vertex Messages

Google's Rust SDK reads only PKCS#8 service account keys, while google-auth
signs with PKCS#1 keys too, so a key in BEGIN RSA PRIVATE KEY form failed
every Vertex Messages login with a ValueError. The key is now re-encoded as
PKCS#8 with the rsa crate before the SDK reads it.

Adds auth-gcp/PARITY.md, which lists each Vertex login path that behaves
differently from Python or runs through legacy/, and an AGENTS.md rule to
keep it in step with login changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(auth-gcp): list only legacy and unsupported Vertex login paths in PARITY.md

The table now keeps two statuses. Legacy is a path that works only through
code added on top of Google's Rust SDK, Unsupported is a path that worked in
Python and fails here. Paths that work, or fail as they did in Python, are
left out, and the credential helper shell syntax row moves to Unsupported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(auth-gcp): split the Vertex login into google and vertex layers

Nothing in auth-gcp's vertex_messages module was specific to Messages. It
ported google-auth plus litellm's VertexBase.load_auth, which Python shares
across every Vertex route and which other Google services will reuse.

- google/ is google-auth itself: credential files, application default
  credentials, the metadata server, SDK builders, the exception classes
  and the legacy/ logins for paths the SDK lacks. It never imports vertex.
- vertex/ is litellm's VertexBase on top: vertex_credentials,
  vertex_project and vertex_location, the explicit aws_* login, project
  resolution and the key-file fallback. VertexMessagesAuth is now
  VertexLoginService and AuthServices.vertex_messages is vertex_login.
- vertex_region picks a region, not a token, so it moves to llms'
  vertex_ai common_utils.

No behavior change. Files move, imports and visibility follow, error text
is byte-identical, and each layer gets an AGENTS.md saying what belongs
there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(env): move the process environment snapshot into litellm-env

process_environment and variable read the process environment and are not
specific to how requests picks a proxy or CA bundle, so they move from
litellm-http's requests_env into litellm-env beside the other environment
lookups. Behaviour is unchanged.

* refactor(vertex_ai): read supported_regions in the llms vertex_ai module

The vertex_ai/ catalog key and the supported_regions parsing move out of the
python-bridge model catalog into litellm-llms' vertex_ai common_utils, so the
bridge only hands it the live catalog, as it does for Bedrock.

* refactor(callbacks): let the messages route name the provider params it logs

callbacks-legacy-python no longer knows about Vertex AI. The Messages route in
python-bridge registers a LoggedCallParam for vertex_ai built from
EXPLICIT_LOCATION_PARAMS in the llms vertex_ai module, and the adapter logs the
first non-empty text param for the matching provider exactly as before.

* refactor(auth-gcp): name credential file types with a strum enum

CredentialsType spells each google-auth credential type once. The impersonated
source check, the explicit credentials field-error check and the valid-types
message use it instead of string literals.

* docs(auth-gcp): say the explicit AWS login uses AWS as the identity provider

* docs(rust): document the test-support feature pattern

* fix(auth-gcp): refuse plain http impersonation URLs off this machine

The legacy impersonation path sends the source credentials' token as a bearer
to the service_account_impersonation_url. A plain http URL to any host other
than loopback (127.0.0.0/8, ::1, localhost) now fails with RefreshError before
the token is fetched or sent. google-auth sends it, so PARITY.md lists the
path as Unsupported.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:15:10 +00:00
..
a2a refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
aiml chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
aiohttp_openai fix(aiohttp_openai): forward service_tier in transform_response (#47263) 2026-10-28 13:14:44 -07:00
anthropic feat(messages): serve vertex ai claude messages on rust only (#52314) 2026-11-19 21:15:10 +00:00
apiserpent
aws_polly fix(aws_polly): read the engine from the bare model name (#47963) 2026-10-23 18:10:51 -07:00
azure test(azure): restore client session after extra headers test (#52815) 2026-11-19 08:27:46 +00:00
azure_ai fix(responses): scope cacheable system input to stateless requests (#52694) 2026-11-18 17:24:52 -08:00
base_llm feat(sarvam): send a litellm User-Agent on chat requests (#52012) 2026-11-17 23:52:53 +00:00
baseten fix(aiand)!: show ai&'s name and logo, and sync ai&'s model list (#49158) 2026-10-30 10:55:26 -07:00
bedrock fix(bedrock): return a response for empty Invoke streams with complete_response (#52862) 2026-11-19 17:49:30 +00:00
bedrock_mantle feat(messages): serve bedrock mantle messages on rust only (#52328) 2026-11-18 17:36:06 -08:00
bigmodel feat(zai): support response_format and max_completion_tokens, add glm-5v-turbo pricing (#48335) 2026-10-29 20:30:50 -07:00
black_forest_labs refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
brave chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
bytez
cerebras
chat fix(router): read the first stream chunk before returning so a failure before any token runs through the retry and fallback budget (#46493) 2026-10-14 14:19:25 -07:00
chatgpt fix(chatgpt): preserve parallel_tool_calls and enforce Codex Responses-Lite contract (#52731) 2026-11-18 17:59:31 -08:00
clarifai refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
claude_code refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
clf_ai_gateway refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
cloudflare fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00
codestral fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00
codex refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
cohere fix(cohere)!: map tool_choice, reasoning_effort and json_schema response_format on the v2 chat route (#50834) 2026-11-17 18:10:37 +00:00
cometapi chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
compactifai refactor(typing): clear 1181 basedpyright Any errors across 431 files (#47789) 2026-10-24 11:31:09 -07:00
crusoe fix(crusoe): update base URL to current endpoint (#33121) 2026-10-15 19:10:58 -07:00
custom_httpx fix(httpx): repair surrogate code points in raw text request bodies (#49599) 2026-11-19 11:48:18 -08:00
dashscope fix(dashscope): bill 1h cache writes at the 1h rate (#52331) 2026-11-17 12:07:01 -08:00
databricks fix(tests): repair the unit tests failing on main's full run (#52769) 2026-11-18 22:41:59 -08:00
dataforseo refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
datarobot
deepagents feat: add litellm.agent() to run claude code, codex, opencode and deep agents through the ai gateway (#43885) 2026-10-01 22:27:49 +00:00
deepgram fix(audio-transcription): keep transcripts out of transcription error messages (#50137) 2026-11-05 18:07:15 -08:00
deepinfra chore(cost-map): add Soniox v6 and date Soniox, Bedrock Claude and Azure Whisper retirements (#51620) 2026-11-13 12:37:12 -08:00
deepseek fix(proxy): count tokens with the thinking, effort, and tool_choice that inference sends (#51079) 2026-11-14 02:29:16 +00:00
docker_model_runner
duckduckgo chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
e2b refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
edenai feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
elevenlabs feat(tts)!: stream audio from the provider as it arrives on /v1/audio/speech (#46222) 2026-11-17 15:03:12 +00:00
empiriolabs feat(decisions): add EmpirioLabs AI as a decisions provider (#49977) 2026-11-04 10:41:16 -08:00
exa_ai fix(exa): return highlights, highlight scores, score and the response envelope from Exa search (#47423) 2026-10-19 15:45:56 -07:00
fal_ai fix(cost-map): price eight-second Pixverse clips (#52107) 2026-11-16 12:49:55 -08:00
fastcrw fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
featherless_ai refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
firecrawl fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
fireworks_ai fix(fireworks_ai): read fractional sizes like 1p5b in the size bucket fallback (#51451) 2026-11-13 17:49:49 +00:00
friendliai fix(friendliai): drop litellm-internal message fields before sending (#45092) 2026-10-20 01:22:07 +00:00
gdc test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
gemini fix(images): normalize null cached token counts (#52857) 2026-11-19 17:49:26 +00:00
gigachat refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
github_copilot fix(github_copilot): explain why a Copilot call failed and how to fix it (#52352) 2026-11-18 02:31:12 +00:00
google_pse chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
gradient_ai fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
groq fix(groq): default service_tier when the reply omits it (#52431) 2026-11-18 13:17:14 -08:00
heroku fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
hosted_vllm fix(hosted_vllm): omit empty tools list from chat requests (#50812) 2026-11-09 19:49:13 -08:00
huggingface fix(huggingface): honor HUGGINGFACE_API_BASE and env endpoints for chat (#51449) 2026-11-13 10:35:34 -08:00
hyperbolic refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
inception refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
infinity chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
jina_ai fix(rerank): preserve token usage in spend logs (#49308) 2026-10-30 13:46:27 -07:00
lambda_ai test: move the unit half of 126 mixed legacy files into tests/unit (#45090) 2026-10-07 14:07:43 -07:00
langflow fix(ci): stop stale CI reds, keep unit tests off the host env, retry CyberArk policy conflicts (#43294) 2026-09-26 09:25:13 -07:00
langgraph fix(streaming)!: fail a stream that ends without a finish reason (#47665) 2026-10-31 11:29:26 -07:00
laya feat: add Bespoke Nimble gateway and OSS classifier support (#44246) 2026-10-02 19:37:08 -07:00
lemonade chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
linkup fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
litellm_proxy refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
llamafile refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
lm_studio refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
manus test: migrate SDK and proxy-booting legacy CircleCI tests to their tiers (#45758) 2026-10-11 00:17:21 -07:00
meta fix(realtime)!: keep turn_detection.type when a transcript guardrail disables auto-response (#44939) 2026-10-16 15:24:40 +00:00
meta_llama refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
microsoft_365_copilot refactor(router): route the router family through RoutingContext and close the outside surface (#49118) 2026-10-30 19:18:54 -07:00
milvus test: migrate legacy unit dirs and unrun folders into tests/unit, tests/integration and tests/e2e (#45940) 2026-10-11 06:24:57 -07:00
minimax fix(minimax): forward reasoning_effort instead of dropping it (#49583) 2026-11-09 14:03:50 -08:00
mistral test(responses): align bridged system prompt expectations (#52693) 2026-11-19 00:27:35 +00:00
modelscope fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
mongodb feat(bedrock): search knowledge bases by image and return image hits (#51063) 2026-11-12 00:19:34 +00:00
moonshot feat(moonshot): add Kimi K3 and Together AI Inkling model support (#33922) 2026-11-18 16:26:14 +00:00
morph feat(morph): support open models and cached input pricing (#48676) 2026-10-27 18:06:14 -07:00
nadir test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
nebius test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
neosantara refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
nimble test: move whole-unit legacy test files into tests/unit and delete dead skips (#44807) 2026-10-07 05:02:28 +00:00
nlp_cloud refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
novita
nscale
nvidia_nim fix(embeddings): unwrap extra_body for providers with their own embedding handlers (#51335) 2026-11-12 15:41:50 -08:00
nvidia_riva fix(nvidia_riva): send the api key exactly once by calling riva over grpc directly (#50140) 2026-11-04 18:07:31 -08:00
oci fix(fips): hash MCP advisory-lock keys with SHA-256 in fips_mode and compute the OCI body digest as a security hash (#51165) 2026-11-11 16:22:14 -08:00
ocr
ollama fix(ollama): log missing prompt_eval_count through verbose_logger (#52432) 2026-11-18 16:33:44 -08:00
oobabooga fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00
openai fix(guardrails): mask reasoning text on /v1/responses output (#52504) 2026-11-19 01:25:06 -08:00
openai_like feat(providers): add Sarvam Token Factory v2 models (#49792) 2026-11-18 13:19:05 +00:00
opencode fix(opencode_go): forward chat reasoning effort (#52156) 2026-11-16 16:31:56 -08:00
openrouter fix: raise on failed OpenRouter non-streaming completions (#50880) 2026-11-14 03:02:00 +00:00
opensandbox chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
opensearch feat(opensearch): map vector store search filters to k-NN filters and add hybrid search (#51131) 2026-11-14 03:30:55 +00:00
ovhcloud fix(audio-transcription): keep transcripts out of transcription error messages (#50137) 2026-11-05 18:07:15 -08:00
parallel_ai refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
parasail refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
pass_through fix(guardrails): exclude litellm_metadata from pass-through guardrail scan text (#48276) 2026-10-26 12:07:58 -07:00
perplexity fix(perplexity): bill cached prompt tokens at the cache read rate when the response has no cost (#51669) 2026-11-16 03:30:13 +08:00
pg_vector fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
pi fix(harness): surface Pi context compaction events (#52655) 2026-11-18 13:52:03 -08:00
publicai test: migrate tests/llm_translation into unit, integration and e2e tiers (#45759) 2026-10-11 07:58:53 +00:00
ragflow test: migrate legacy unit dirs and unrun folders into tests/unit, tests/integration and tests/e2e (#45940) 2026-10-11 06:24:57 -07:00
recraft refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
reducto test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
replicate refactor: share Replicate HTTP client factories and declare PagerDuty type alias (#51594) 2026-11-17 02:32:54 +00:00
runwayml feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
s3_vectors refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
sagemaker fix(bedrock): send max_tokens and priority in Cohere embedding requests (#51435) 2026-11-12 23:44:08 +00:00
sail test(router_strategy): keep foreign asyncio task noise out of the budget limiter caplog asserts (#43375) 2026-10-29 06:22:06 -07:00
sambanova chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
sap fix(sap): accept list-shaped reasoning_content from Gemini 3.x (#52741) 2026-11-18 18:15:10 -08:00
scaledown feat(scaledown): add native text provider support (#44168) 2026-10-10 14:01:17 -07:00
scaleway fix(audio-transcription): keep transcripts out of transcription error messages (#50137) 2026-11-05 18:07:15 -08:00
searchapi chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
searxng chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
serper chore(typing): clear 670 basedpyright Any errors by validating provider payloads at the boundary (#45388) 2026-10-13 15:35:23 -07:00
snowflake fix(anthropic)!: send /v1/messages PDF documents to OpenAI-shaped providers as file parts (#47166) 2026-10-29 08:06:12 -07:00
soniox chore(cost-map): add Soniox v6 and date Soniox, Bedrock Claude and Azure Whisper retirements (#51620) 2026-11-13 12:37:12 -08:00
stability refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00
strands_decider feat(strands_decider): call a Strands Decider on an AgentCore runtime ARN (#45678) 2026-10-09 22:51:19 -07:00
tavily fix(tavily): return raw_content, score, favicon and the response envelope from Tavily search (#48684) 2026-10-27 18:52:06 -07:00
tencent fix(logging): warn when drop_params drops a requested reasoning level on the remaining paths (#48933) 2026-10-30 08:48:43 -07:00
tinyfish test: move whole-unit legacy test files into tests/unit and delete dead skips (#44807) 2026-10-07 05:02:28 +00:00
together_ai fix(together_ai): declare reasoning_effort_levels on Kimi-K3.1-Pro so max is not sent as high (#52294) 2026-11-17 08:20:41 -08:00
tool_loop feat(harness): add Harness.TOOL_LOOP, a minimal in-process tool-calling loop (#44391) 2026-10-03 17:33:01 +00:00
topaz fix(llms): sanitize trailing slashes in provider get_complete_url (#42887) 2026-10-15 02:59:46 -07:00
triton fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00
v0 test: move the unit half of 126 mixed legacy files into tests/unit (#45090) 2026-10-07 14:07:43 -07:00
valkey
vercel_ai_gateway refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
vertex_ai feat(messages): serve vertex ai claude messages on rust only (#52314) 2026-11-19 21:15:10 +00:00
vllm fix(vllm): list hosted_vllm wildcard models when the server has no api key (#40066) 2026-11-03 04:13:28 +00:00
volcengine feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
voyage fix(voyage): honor VOYAGE_API_BASE for embeddings (#52645) 2026-11-18 14:38:57 -08:00
wandb test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
watsonx fix(audio-transcription): keep transcripts out of transcription error messages (#50137) 2026-11-05 18:07:15 -08:00
webiq feat(search): add Microsoft Web IQ provider (#50883) 2026-11-10 22:43:36 +00:00
xai fix(xai): honor deployment image pixel pricing (#50490) 2026-11-07 02:17:16 +00:00
xinference test: move whole-unit legacy test files into tests/unit and delete dead skips (#44807) 2026-10-07 05:02:28 +00:00
you_com
zai feat(zai): support response_format and max_completion_tokens, add glm-5v-turbo pricing (#48335) 2026-10-29 20:30:50 -07:00
__init__.py
test_api_base_trailing_slash_routes.py fix(llms): join api_base and route with one shared helper (#47535) 2026-10-21 06:59:32 +00:00
test_cache_control_and_reasoning.py fix(minimax): forward reasoning_effort instead of dropping it (#49583) 2026-11-09 14:03:50 -08:00
test_custom_llm.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
test_file_content_block.py fix(prompt_templates): keep moved private helpers importable from common_utils (#50721) 2026-11-09 20:52:52 +00:00
test_file_search_responses.py refactor(prompt_templates): move JSON schema helpers out of common_utils into json_schema_utils (#50241) 2026-11-05 17:25:53 -08:00
test_get_complete_url_trailing_slash.py feat(messages): serve vertex ai claude messages on rust only (#52314) 2026-11-19 21:15:10 +00:00
test_lifecycle_fix.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_oss_decision.py feat(decisions): add Laya and Bespoke providers to the Add Model form (#45260) 2026-10-14 08:11:11 -07:00
test_polling_url_origin_match.py test: move tests/test_litellm core utils, routing, responses, caching and rust_bridge into tests/unit (#43199) 2026-09-25 17:10:13 -07:00
test_predibase_transformation.py fix(streaming): keep merged think tags balanced and split SSE lines only on CR/LF (#48755) 2026-10-28 17:00:29 -07:00
test_subscription_accounts.py feat(usage): show subscription-covered providers and account fees separately (#44772) 2026-10-30 03:58:36 -07:00