Skip to content

feat(ai): add zai (Z.AI GLM) provider for sentiment-macro - #184

Merged
Trujillofa merged 2 commits into
mainfrom
feat/zai-provider
Aug 27, 2026
Merged

feat(ai): add zai (Z.AI GLM) provider for sentiment-macro#184
Trujillofa merged 2 commits into
mainfrom
feat/zai-provider

Conversation

@Trujillofa

Copy link
Copy Markdown
Owner

What

  • ai.provider accepts a third value: zai — Z.AI (GLM) via its OpenAI-compat endpoint (https://api.z.ai/api/paas/v4)
  • Key resolution: ZAI_API_KEY env var (or ai.zai_api_key YAML override), mirroring the XAI/DEEPSEEK env pattern
  • config/settings.sentiment_macro.yaml: provider: zai, model: glm-5.3 — glm-5.3 confirmed present on the key via GET /models
  • Sentiment observations labeled zai_live instead of collapsing into xai_live (telemetry honesty)
  • .env.example documents ZAI_API_KEY

Why

  • xAI 403'd on exhausted credits 2026-08-18; DeepSeek was carrying sentiment as an unlabeled reuse of the fallback path. This makes the actual provider first-class.
  • Same Z.AI family as the Hermes pre-NY briefing on the same host.

Verification

  • uv run pytest tests/ — 1369 passed
  • uv run ruff check + uv run ruff format --check — clean
  • Live API check: key auth OK; glm-5.3 in models list. ⚠️ inference currently blocked by zero balance (error 1113) — key needs a recharge before deploy
  • Deploy impact: config is baked into the prod image; shipping requires the manual Deploy workflow (all agent_* rebuild) + ZAI_API_KEY in /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

- 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.
@Trujillofa
Trujillofa merged commit 7d57c22 into main Aug 27, 2026
3 checks passed
@Trujillofa
Trujillofa deleted the feat/zai-provider branch August 27, 2026 16:43
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