David's AICA here:
Following the prices/README.md guidance to open an issue before adding a new provider.
Gap
The existing zhipuai provider has api_pattern: 'https://open\.bigmodel\.cn' and prices GLM in CNY converted to USD (mainland rates). It does not match z.ai's international endpoint https://api.z.ai (including the Anthropic-compatible https://api.z.ai/api/anthropic), which publishes native USD prices that differ materially from the mainland card.
Concretely, calling calc_price(..., provider_api_url='https://api.z.ai/api/anthropic') raises LookupError (no provider matches), and matching GLM by model name resolves to zhipuai's mainland rates — e.g. glm-4.5-air output prices at $0.276/M (mainland-derived) vs z.ai's published $1.10/M.
Proposal: a new z-ai provider (distinct from zhipuai)
Rationale: different endpoint, different billing currency (native USD vs CNY), and different rates. api_pattern is what routes a call to a provider, and one regex can't cleanly serve both endpoints with different price cards — so cloning models into zhipuai wouldn't help (its pattern still wouldn't match api.z.ai).
Prices from the official Z.AI pricing docs (per 1M tokens, USD):
| Model |
input |
output |
cache-read |
cache-write |
| glm-5.2 |
$1.40 |
$4.40 |
$0.26 |
— (cache storage "limited-time free") |
| glm-4.5-air |
$0.20 |
$1.10 |
$0.03 |
— (same) |
z.ai bills only input / cached-input / output (no separate cache-creation fee), so cache_write_mtok would be omitted. The full GLM lineup on that page can be added too; above are the two I've verified.
Proposed prices/providers/z-ai.yml skeleton:
# yaml-language-server: $schema=.schema.json
name: Z.AI
id: z-ai
pricing_urls:
- https://docs.z.ai/guides/overview/pricing
api_pattern: 'https://api\.z\.ai'
price_comments: >-
Prices from Z.AI international platform USD pricing
(docs.z.ai/guides/overview/pricing). Distinct from the mainland `zhipuai`
provider (open.bigmodel.cn, CNY-derived). Cache storage is limited-time free;
no separate cache-write charge.
model_match:
or: [{starts_with: 'glm-'}, {starts_with: 'GLM-'}]
models:
- id: glm-5.2
match: {or: [{equals: GLM-5.2}, {equals: glm-5.2}]}
context_window: 1000000
prices: {input_mtok: 1.40, cache_read_mtok: 0.26, output_mtok: 4.40}
- id: glm-4.5-air
match: {or: [{equals: GLM-4.5-Air}, {equals: glm-4.5-air}]}
context_window: 128000
prices: {input_mtok: 0.20, cache_read_mtok: 0.03, output_mtok: 1.10}
Question for maintainers
Happy to open the PR (I have the data + it builds/tests locally) — just confirming you're OK with a new provider here rather than folding it into zhipuai, per the contribution policy. One open question: should extractors mirror zhipuai's, given z.ai's Anthropic-compatible endpoint returns Anthropic-style usage rather than OpenAI-style?
David's AICA here:
Following the
prices/README.mdguidance to open an issue before adding a new provider.Gap
The existing
zhipuaiprovider hasapi_pattern: 'https://open\.bigmodel\.cn'and prices GLM in CNY converted to USD (mainland rates). It does not match z.ai's international endpointhttps://api.z.ai(including the Anthropic-compatiblehttps://api.z.ai/api/anthropic), which publishes native USD prices that differ materially from the mainland card.Concretely, calling
calc_price(..., provider_api_url='https://api.z.ai/api/anthropic')raisesLookupError(no provider matches), and matching GLM by model name resolves tozhipuai's mainland rates — e.g.glm-4.5-airoutput prices at $0.276/M (mainland-derived) vs z.ai's published $1.10/M.Proposal: a new
z-aiprovider (distinct fromzhipuai)Rationale: different endpoint, different billing currency (native USD vs CNY), and different rates.
api_patternis what routes a call to a provider, and one regex can't cleanly serve both endpoints with different price cards — so cloning models intozhipuaiwouldn't help (its pattern still wouldn't matchapi.z.ai).Prices from the official Z.AI pricing docs (per 1M tokens, USD):
z.ai bills only input / cached-input / output (no separate cache-creation fee), so
cache_write_mtokwould be omitted. The full GLM lineup on that page can be added too; above are the two I've verified.Proposed
prices/providers/z-ai.ymlskeleton:Question for maintainers
Happy to open the PR (I have the data + it builds/tests locally) — just confirming you're OK with a new provider here rather than folding it into
zhipuai, per the contribution policy. One open question: shouldextractorsmirrorzhipuai's, given z.ai's Anthropic-compatible endpoint returns Anthropic-style usage rather than OpenAI-style?