Skip to content

feat(ai): add Z.ai image generation - #37780

Merged
rekram1-node merged 2 commits into
v2from
zai-images
Jul 20, 2026
Merged

feat(ai): add Z.ai image generation#37780
rekram1-node merged 2 commits into
v2from
zai-images

Conversation

@opencode-agent

@opencode-agentopencode-agentBot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add ZAI.configure(...).image(modelID) with ZAI_API_KEY bearer fallback, configurable auth/base URL/headers/HTTP overlays, and arbitrary model IDs
  • infer open request-scoped Z.ai options while preserving known value kinds, arbitrary native fields, and future string values
  • lower userID to user_id, let raw native fields override aliases, and give http.body final precedence
  • decode provider output structurally without local model/value compatibility rejections
  • represent hosted URL results as application/octet-stream because Z.ai does not return trustworthy MIME metadata
  • preserve the merged Google image documentation and add concise Z.ai usage plus the 30-day URL expiry warning

API

Image.generate({model: ZAI.configure({ apiKey }).image("any-model-id"),
prompt,options: {quality: "hd",userID: "user-123",future_option: true,},
http,})

Tests

  • bun x prettier --check README.md src/protocols/zai-images.ts src/providers/index.ts src/providers/zai.ts test/image.types.ts test/provider/zai-images.test.ts test/provider/zai-images.recorded.test.ts test/fixtures/recordings/zai-images/generates-an-image.json
  • bun typecheck
  • bun run build
  • bun test --timeout 30000 --only-failures (386 passed, 29 skipped)
  • RECORDED_PROVIDER=zai bun test test/provider/zai-images.recorded.test.ts --timeout 30000 --only-failures (1 passed)
  • git diff --check origin/v2
  • bounded credential-pattern scan of the PR diff
  • clean git merge-tree --write-tree origin/v2 HEAD

Requested by: @rekram1-node (Aiden Cline via Slack)

@rekram1-node
rekram1-node merged commit fa4ec98 into v2Jul 20, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the zai-images branch July 20, 2026 20:53
github-actionsBot pushed a commit to ReStranger/opencode that referenced this pull request Jul 20, 2026
* upstream/v2: (63 commits)
feat(codemode): add Set method parity (anomalyco#38000)
fix(core): match dev patch behavior (anomalyco#37709)
refactor(tui): migrate diff viewer to V2 theme (anomalyco#37999)
feat(ai): support image-guided generation (anomalyco#37998)
feat(ai): add Z.ai image generation (anomalyco#37780)
chore: merge dev into v2 (anomalyco#37996)
refactor(tui): expose theme colors as properties (anomalyco#37995)
feat(ai): add Google image generation (anomalyco#37781)
fix(cli): isolate bun updater cache
feat(ai): add xAI image generation (anomalyco#37778)
feat(codemode): add groupBy parity (anomalyco#37992)
refactor(ai): infer image provider options (anomalyco#37948)
fix(core): ignore empty provider api keys
feat(tui): add categorical theme hues (anomalyco#37985)
refactor(core): inject models options
refactor(server): inject database options
fix(tui): make migrated selected background transparent (anomalyco#37967)
feat(codemode): complete date parity (anomalyco#37960)
feat(codemode): complete regexp and math parity (anomalyco#37955)
fix(tui): adapt file badge accent to theme mode (anomalyco#37953)
...
github-actionsBot pushed a commit to ReStranger/opencode that referenced this pull request Jul 21, 2026
* upstream/v2: (65 commits)
refactor(server): inject runtime options
refactor(server): centralize server options
feat(codemode): add Set method parity (anomalyco#38000)
fix(core): match dev patch behavior (anomalyco#37709)
refactor(tui): migrate diff viewer to V2 theme (anomalyco#37999)
feat(ai): support image-guided generation (anomalyco#37998)
feat(ai): add Z.ai image generation (anomalyco#37780)
chore: merge dev into v2 (anomalyco#37996)
refactor(tui): expose theme colors as properties (anomalyco#37995)
feat(ai): add Google image generation (anomalyco#37781)
fix(cli): isolate bun updater cache
feat(ai): add xAI image generation (anomalyco#37778)
feat(codemode): add groupBy parity (anomalyco#37992)
refactor(ai): infer image provider options (anomalyco#37948)
fix(core): ignore empty provider api keys
feat(tui): add categorical theme hues (anomalyco#37985)
refactor(core): inject models options
refactor(server): inject database options
fix(tui): make migrated selected background transparent (anomalyco#37967)
feat(codemode): complete date parity (anomalyco#37960)
...
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@rekram1-node