You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Added
XaiClient and AsyncXaiClient take base_url, with XAI_BASE_URL as a fallback and https://api.x.ai/v1 as the default. REST calls and the stt, tts, and realtime websockets use that base. Chat on an empty path or /v1 stays on gRPC; any other path uses REST /chat/completions. Invalid URLs raise ValueError without echoing credentials. Collections, batch, OAuth connect, and the usage meter price fetch do not follow base_url. (#93)
Non-default base_url hosts restrict best and economy to that host's GET /v1/models list (fetched once per client, roles from the static catalog). An unpinned role with no listed model raises RoleUnavailableOnHost before the request. A failed model list warns and uses the static catalog, still on the configured host. The default host is unchanged. (#94)
The usage meter applies the documented 10% US endpoint token premium on us.api.x.ai to input, cached input, output, and image input tokens. The rate is one hardcoded host table. Server cost_in_usd_ticks stay unchanged. Other hosts and per-unit fees stay at the base price. (#95)