mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-23 00:41:40 +00:00
Slice 3 of the Claude Code Compatibility Matrix: wire the
`tests/claude_code/` suite into CircleCI as a pre-merge gate. A red
status on the new `claude_code_compat_pr_gate` job blocks merge into
the staging branch.
What landed:
- tests/claude_code/pr_gate_version_resolver.py
The Claude Code PR-Gate Version Resolver described in the PRD's
"Version resolvers" section. Queries the npm registry for
`@anthropic-ai/claude-code` and returns the newest version whose
publish timestamp is at least 3 days old. The 3-day window is a
security review buffer: a malicious or broken Claude Code release
has at least 72 hours to be detected before it can land in our PR
gate. Importable function (with `metadata=` / `fetcher=` / `as_of=`
injection seams for tests) and a `python -m ...` CLI for the CI step.
- tests/claude_code/test_config.yaml
Proxy routing config that maps the per-cell aliases the tests use
(`claude-haiku-4-5`, `claude-haiku-4-5-bedrock-invoke`, ...,
`claude-opus-4-7-vertex`) to real upstream model ids on Anthropic /
Bedrock (Invoke + Converse) / Vertex AI. Azure intentionally has no
entries here because every Azure × claude-code cell is
`not_applicable` (Azure OpenAI doesn't host Claude).
- .circleci/config.yml
New `claude_code_compat_pr_gate` job. Pattern modeled on
`proxy_e2e_anthropic_messages_tests` (load PR-built docker image,
start postgres, mount config.yaml). New step in the middle:
resolve the Claude Code version from the resolver, install Node 20
via the machine image's preinstalled nvm, and `npm install -g
@anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}` (pinned, never
`latest`). Wired into `workflows.build_and_test` with a
`requires: [build_docker_database_image]` gate and the same
`*main_branches` filter the other proxy e2e job uses.
- tests/claude_code/_pr_gate_unit_tests/
16 new unit tests:
* 8 against the version resolver: boundary (>= 3d inclusive),
empty / all-too-new metadata, semver-vs-publish-time tiebreak,
custom min_age, fetcher injection, npm `time.created` /
`time.modified` skipping.
* 8 structural tests against `.circleci/config.yml`: job exists,
is in the workflow, requires the docker image, invokes the
resolver, install command is pinned (rejects unpinned `latest`),
runs `tests/claude_code/`, mounts `test_config.yaml`, exports
`LITELLM_PROXY_BASE_URL` / `LITELLM_PROXY_API_KEY`. Plus one
regression test: the existing `proxy_e2e_anthropic_messages_tests`
job is unchanged in shape (acceptance criterion).
Key decisions:
- "Newest version" in the resolver is by **publish time**, not by
semver string ordering — if a patch lands on an older major after a
newer release, the patched line is the eligible one. (Tested.)
- The resolver's CLI prints the announcement to stderr and the bare
version to stdout, so the CI step can do
`CLAUDE_CODE_VERSION=$(uv run python -m ...)` cleanly while still
surfacing the selected version in the job log (acceptance criterion:
"the selected Claude Code version is logged").
- The structural CircleCI tests live under `_pr_gate_unit_tests/` so
the conftest path-inference hook skips them (the leading underscore
is the existing convention from `_driver_unit_tests/` /
`_builder_unit_tests/`); they don't pollute the matrix artifact.
- No `--no-verify` style supply-chain safety relaxation. Per the PRD,
Claude Code's pinning is the 3-day publish-age window, not a fixed
hash — by design, since the daily cron also pulls newer versions.
Tests: 47 -> 47 passing for the unit suite (16 new + 31 from slices
1 and 2). The end-to-end cells under `basic_messaging_non_streaming/`
require `LITELLM_PROXY_BASE_URL` / `LITELLM_PROXY_API_KEY` and a
running proxy + `claude` CLI; they only run inside the new CircleCI
job.
Out of scope per CLAUDE.md (docs live in BerriAI/litellm-docs):
- No docs PR is needed for this slice — the gate produces a status
check, not a published artifact. The compat matrix JSON the docs
page consumes is published by the daily-cron job (a future slice),
not by the PR gate.
Notes for next iteration:
- The daily cron / matrix publisher is the next slice. Several
pieces this slice introduces (the `tests/claude_code/test_config.yaml`
proxy config, the structure of the compat-results.json artifact)
will be reused by it.
- The bedrock-converse / vertex_ai aliases in `test_config.yaml` use
best-guess upstream model ids (`us.anthropic.claude-{tier}` and
`vertex_ai/claude-{tier}`); the real ids may need to be tightened
once the gate runs against live AWS / GCP credentials and we see
what resolves.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
85 lines
3.1 KiB
YAML
85 lines
3.1 KiB
YAML
# Proxy routing config for the Claude Code Compatibility Matrix PR gate.
|
|
#
|
|
# The tests under `tests/claude_code/` only know **alias** names (e.g.
|
|
# `claude-haiku-4-5-bedrock-invoke`). The proxy is the layer that maps
|
|
# each alias to a real upstream model id, region, and credentials.
|
|
#
|
|
# Adding a new (feature, provider) cell is a three-step change in the
|
|
# test repo (manifest + test file + alias here); changing which upstream
|
|
# model a cell exercises is a one-step change here, with no test edits.
|
|
#
|
|
# Aliases:
|
|
# - claude-{tier} → Anthropic API
|
|
# - claude-{tier}-bedrock-invoke → Bedrock InvokeModel API
|
|
# - claude-{tier}-bedrock-converse → Bedrock Converse API
|
|
# - claude-{tier}-vertex → GCP Vertex AI
|
|
|
|
model_list:
|
|
# ---- Anthropic ----
|
|
- model_name: claude-haiku-4-5
|
|
litellm_params:
|
|
model: anthropic/claude-haiku-4-5
|
|
api_key: os.environ/ANTHROPIC_API_KEY
|
|
- model_name: claude-sonnet-4-6
|
|
litellm_params:
|
|
model: anthropic/claude-sonnet-4-6
|
|
api_key: os.environ/ANTHROPIC_API_KEY
|
|
- model_name: claude-opus-4-7
|
|
litellm_params:
|
|
model: anthropic/claude-opus-4-7
|
|
api_key: os.environ/ANTHROPIC_API_KEY
|
|
|
|
# ---- Bedrock (InvokeModel) ----
|
|
- model_name: claude-haiku-4-5-bedrock-invoke
|
|
litellm_params:
|
|
model: bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0
|
|
aws_region_name: us-east-1
|
|
- model_name: claude-sonnet-4-6-bedrock-invoke
|
|
litellm_params:
|
|
model: bedrock/us.anthropic.claude-sonnet-4-6
|
|
aws_region_name: us-east-1
|
|
- model_name: claude-opus-4-7-bedrock-invoke
|
|
litellm_params:
|
|
model: bedrock/us.anthropic.claude-opus-4-7
|
|
aws_region_name: us-east-1
|
|
|
|
# ---- Bedrock (Converse) ----
|
|
- model_name: claude-haiku-4-5-bedrock-converse
|
|
litellm_params:
|
|
model: bedrock/converse/us.anthropic.claude-haiku-4-5-20251001-v1:0
|
|
aws_region_name: us-east-1
|
|
- model_name: claude-sonnet-4-6-bedrock-converse
|
|
litellm_params:
|
|
model: bedrock/converse/us.anthropic.claude-sonnet-4-6
|
|
aws_region_name: us-east-1
|
|
- model_name: claude-opus-4-7-bedrock-converse
|
|
litellm_params:
|
|
model: bedrock/converse/us.anthropic.claude-opus-4-7
|
|
aws_region_name: us-east-1
|
|
|
|
# ---- Vertex AI ----
|
|
- model_name: claude-haiku-4-5-vertex
|
|
litellm_params:
|
|
model: vertex_ai/claude-haiku-4-5
|
|
vertex_ai_project: pathrise-convert-1606954137718
|
|
vertex_ai_location: us-east5
|
|
- model_name: claude-sonnet-4-6-vertex
|
|
litellm_params:
|
|
model: vertex_ai/claude-sonnet-4-6
|
|
vertex_ai_project: pathrise-convert-1606954137718
|
|
vertex_ai_location: us-east5
|
|
- model_name: claude-opus-4-7-vertex
|
|
litellm_params:
|
|
model: vertex_ai/claude-opus-4-7
|
|
vertex_ai_project: pathrise-convert-1606954137718
|
|
vertex_ai_location: us-east5
|
|
|
|
general_settings:
|
|
# Claude Code sends provider-specific headers (e.g. anthropic-beta) we
|
|
# want to forward verbatim to the upstream so the wire-shape under
|
|
# test matches what real customers send.
|
|
forward_client_headers_to_llm_api: true
|
|
|
|
litellm_settings:
|
|
drop_params: true
|
|
modify_params: true
|