Documentation
¶
Overview ¶
Package zai resolves Z.AI (Zhipu GLM) API base URLs for General (pay-as-you-go) and Coding Plan subscriptions, with full support for both OpenAI-compatible and Anthropic-compatible endpoints, plus International vs China regions.
This mirrors the structure of catalog/xiaomi/ for proper plan + region + dual-protocol separation. Official docs document separate "International" and "China" options for both General and Coding Plan.
Index ¶
Constants ¶
const ( GeneralInternationalOpenAIBase = "https://api.z.ai/api/paas/v4" CodingInternationalOpenAIBase = "https://api.z.ai/api/coding/paas/v4" GeneralChinaOpenAIBase = "https://open.bigmodel.cn/api/paas/v4" CodingChinaOpenAIBase = "https://open.bigmodel.cn/api/coding/paas/v4" )
OpenAI-compatible bases (primary for /models and chat/completions).
const ( InternationalAnthropicBase = "https://api.z.ai/api/anthropic" ChinaAnthropicBase = "https://open.bigmodel.cn/api/anthropic" )
Anthropic-compatible bases.
const ( ProviderGeneral = "zai_payg" ProviderCoding = "zai_coding" )
Provider IDs.
Variables ¶
This section is empty.
Functions ¶
func AppendKeyMismatchHint ¶
func KeyMismatchHint ¶
KeyMismatchHint (kept for future key prefix detection).
func ResolveAnthropicBase ¶
ResolveAnthropicBase returns the Anthropic-compat base for the region.
Types ¶
type Plan ¶
type Plan string
Plan identifies the billing product.
func PlanForProvider ¶
PlanForProvider maps gateway ID to plan.
type Region ¶
type Region string
Region identifies International (api.z.ai) vs China (bigmodel.cn family).
func NormalizeRegion ¶
NormalizeRegion accepts common names for the two regions.