feat(ai): add zai (Z.AI GLM) provider for sentiment-macro - #184
Merged
Conversation
- ai.provider now accepts 'zai' alongside xai/deepseek - Key from ZAI_API_KEY env (or ai.zai_api_key override); OpenAI-compat endpoint defaults to https://api.z.ai/api/paas/v4 - Sentiment observations labeled zai_live (no more deepseek/xai mislabels) - settings.sentiment_macro.yaml: provider zai, model glm-5.3 - xAI remains dead (403 since 2026-08-18); DeepSeek kept as fallback config
The ZAI_API_KEY on the host is a Coding Plan subscription key. It only answers on https://api.z.ai/api/coding/paas/v4; the pay-as-you-go /api/paas/v4 default returns error 1113 (no PAYG balance) for it. Verified end-to-end from the Hetzner host: strategy-identical prompt on glm-5.3 returns clean JSON {"score": 58, ...} on the coding endpoint.
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
ai.provideraccepts a third value:zai— Z.AI (GLM) via its OpenAI-compat endpoint (https://api.z.ai/api/paas/v4)ZAI_API_KEYenv var (orai.zai_api_keyYAML override), mirroring the XAI/DEEPSEEK env patternconfig/settings.sentiment_macro.yaml:provider: zai,model: glm-5.3— glm-5.3 confirmed present on the key viaGET /modelszai_liveinstead of collapsing intoxai_live(telemetry honesty).env.exampledocumentsZAI_API_KEYWhy
Verification
uv run pytest tests/— 1369 passeduv run ruff check+uv run ruff format --check— cleanglm-5.3in models list.agent_*rebuild) +ZAI_API_KEYin/opt/crypto-agent/.env. Sentiment-macro is paper mode (trading_execution.enabled: false), so worst case pre-recharge is neutral-fallback scores + a degradation Telegram page.🤖 Generated with OpenCode