Skip to content

feat(providerroutes): path-prefix routing + model_map + N:M compat matrix#3

Merged
damonleelcx merged 2 commits into
develop-v1.0.4from
feature/model-mapping-egress-v1.0.4
Jul 23, 2026
Merged

feat(providerroutes): path-prefix routing + model_map + N:M compat matrix#3
damonleelcx merged 2 commits into
develop-v1.0.4from
feature/model-mapping-egress-v1.0.4

Conversation

@damonleelcx

Copy link
Copy Markdown

pkg — providerroutes engine (shared)

  • Path-prefix routing + model_map.
  • N:M compat matrix (protocol × provider) + registry digest.

Shared engine consumed by aikey-proxy and the control plane.

Part of the model-mapping-egress-v1.0.4 feature (7 repos)

pkg · aikey-proxy · aikey-cli · aikey-config-tool · aikey-control · aikey-control-master (→ develop-v1.0.4) and roadmap20260320 (docs → main).

Verification status (honest)

  • Live GLM L2 mapping — client claude-opus-4-8 → mapped glm-4.6 → GLM served → restored (streaming too); all TestLive_* pass with the real key.
  • Request-chain attribution — verified live: provider=zhipu (declared anthropic → attributed zhipu), protocol=anthropic, base_url open.bigmodel.cn/api/anthropic, real message_id + token usage.
  • aikey use two-axis summary + provider(s) mislabel fix — verified live against the real binary (new tests/e2e_use_two_axis_live.rs); PROTOCOL and PROVIDER render as separate columns (anthropic | zhipu(GLM)).
  • ✅ All test suites green (proxy full, cli 1084 lib, dbmigrate fixture-matrix, both web bundles).
  • ⚠️ Not yet verified — P7 infra (Windows/阿里云 three-env, fault injection) is blocked; L1/L3/L4 live-DB + real-backend browser render remain stub-only.

🤖 Generated with Claude Code

…ix + registry digest

Model-mapping-egress data plane (targets develop-v1.0.4):
- Route struct path_prefix + longest-prefix (host,path_prefix) lookup (P1b)
- per-provider model_map + build-time validation (P1)
- SupportsProviderProtocol / Protocols/ProvidersFor + compat matrix (P1i)
- SHA256 + Go/Rust golden cross-language parity gate (P1c)
- Digest() for the proxy /v1/diagnostics/pipeline registry provenance (7.9)

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

Copy link
Copy Markdown
Author

🔬 Live evidence — path-prefix routing + model_map resolved against the real vendor

Run on Aliyun cn-shenzhen + macOS + Windows Server 2025, branch feature/model-mapping-egress-v1.0.4, real GLM/zhipu key.

The embedded registry built from provider_fingerprint.yaml was exercised end-to-end through aikey-proxy:

  • (host, path_prefix) routingopen.bigmodel.cn + /api/anthropic resolved to protocol=anthropic, provider=zhipu, base_url=https://open.bigmodel.cn/api/anthropic (the N:M compat row), not the sibling /api/paas (openai_compatible) or /api/coding/paas/v4 rows.
  • model_mapResolveModel(zhipu, "claude-opus-4-8") → "glm-4.6", and the real GLM endpoint served glm-4.6 (proving the map reached the vendor, not just a local rewrite).
  • truthful attributionLookupByBaseURL flipped the declared anthropic to the real zhipu for the usage record.

/v1/diagnostics/pipeline exposes the registry provenance measured live:

{"registry":{"digest":"d190c3562312","route_rows":21,"providers_with_model_map":["zhipu"]}}

Full L1/L2 persisted-row assertions + three-env matrix + tc/netem fault injection are in the aikey-proxy PR. Cross-language parity gate (7.5) and the N:M compatibility-matrix form-validation (7.5c) were not independently exercised this run.

…R review)

roleOfModel's final `strings.Contains(lower,"-"+role)` clause was not
segment-aligned (contradicting its own comment) and made the anchored clauses
dead code; knownRoles map iteration was nondeterministic on co-occurring tokens.
Now: only exact/prefix(`role-`)/suffix(`-role`)/infix(`-role-`) matches, iterated
over an ordered rolesInMatchOrder slice. Adds anchored + resolve-level vectors
incl. the negative `claude-haikuish-1` (the old loose match mis-matched to haiku).
Mirrored in aikey-cli role_of_model for Go/Rust parity.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@damonleelcx
damonleelcx merged commit 3e3cf8a into develop-v1.0.4 Jul 23, 2026
10 of 12 checks passed
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.

1 participant