Skip to content

feat(sdkx/llm): add image-generation adapters + align chat caps#72

Merged
lIang70 merged 3 commits into
mainfrom
feat/sdkx-image-adapters
May 7, 2026
Merged

feat(sdkx/llm): add image-generation adapters + align chat caps#72
lIang70 merged 3 commits into
mainfrom
feat/sdkx-image-adapters

Conversation

@lIang70

@lIang70 lIang70 commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Builds on the new sdk/llm primitives shipped in sdk/v0.2.8 (#71)
to deliver three production image-generation adapters and align
existing chat catalogs with the new output-modality capabilities.

Catalog alignment (chat models, text-only output)

openai / anthropic / deepseek / qwen / minimax (M2 chat)
/ bytedance (Doubao Seed chat) — DisabledCaps now also
disables CapImageOutput and CapAudioOutput. Without this, the
blacklist semantics would silently advertise image / audio output
on every chat-only catalog. Verified against each provider's
current public model list (2026-04-30).

New image-generation adapters

Provider key Path Endpoint Notable
minimax-image sdkx/llm/minimax/image /v1/image_generation image-01 / image-01-live; subject_reference for i2i
bytedance-image sdkx/llm/bytedance/image /api/v3/images/generations Seedream 5.0 / 5.0-lite / 4.5 / 4.0; multi-ref + sequential generation; web_search / optimize_prompt_mode escape hatches
qwen-image sdkx/llm/qwen/image /api/v1/services/aigc/multimodal-generation/generation Qwen-Image 2.0 Pro / 2.0 / Max / Plus; default Beijing region; rejects PartImage inputs (t2i-only contract)

Each adapter:

  • Implements the standard llm.LLM interface.
  • Wraps synchronous responses via the public
    llm.NewOneChunkStream helper to satisfy llm.StreamMessage.
  • Has its own DisabledCaps profile (CapVision + CapImageOutput
    on, every chat-completion knob off).
  • Maps provider-specific error codes to typed errdefs categories.
  • Ships with a gofmt-stable doc.go and a self-contained unit
    test suite using httptest.

Provider keys are deliberately distinct from chat keys

minimax-image (vs minimax), bytedance-image (vs bytedance),
qwen-image (vs qwen). This keeps the capability matrix clean —
chat catalogs advertise text-only output, image catalogs advertise
CapImageOutput. Same upstream API key works for both pools but
they are tracked independently for routing / rate-limit purposes.

Dependency bump

sdkx/go.mod: github.com/GizClaw/flowcraft/sdkv0.2.8

Pulls in the new CapImageOutput / CapAudioOutput /
ImageGenOptions / NewOneChunkStream surface that this PR
consumes.

Test plan

  • cd sdkx && GOWORK=off go vet ./...
  • cd sdkx && GOWORK=off go test ./llm/... -count=1 -race
  • Live API smoke run via tests/conformance/llm/image_test.go
    (5 scenarios × 3 providers, all green; saved sample images
    verified visually).

Follow-ups

  • tests/conformance: bump sdkx pin to the upcoming sdkx tag and
    drop the local replace directives. Will land once auto-tag
    publishes the sdkx version produced by this PR's merge.

Made with Cursor

lIang70 and others added 3 commits May 7, 2026 18:31
Catalog alignment (chat models, all text-only output):

- openai / anthropic / deepseek / qwen / minimax (M2 chat) /
  bytedance (Doubao Seed chat) — DisabledCaps now also includes
  CapImageOutput and CapAudioOutput so the new output-modality
  capabilities introduced in sdk v0.2.8 default to "not supported"
  on every existing chat catalog rather than silently advertising
  image / audio output. Verified against each provider's current
  public model list (2026-04-30).

New image-generation adapters (each implements llm.LLM and uses the
public llm.NewOneChunkStream wrapper from sdk v0.2.8):

- sdkx/llm/minimax/image — registers provider key "minimax-image"
  with image-01 / image-01-live; targets MiniMax's
  /v1/image_generation endpoint; handles subject_reference URLs
  for image-to-image.

- sdkx/llm/bytedance/image — registers provider key
  "bytedance-image" with the Doubao Seedream 5.0 / 5.0-lite / 4.5
  / 4.0 lineup; targets Volc Ark's /api/v3/images/generations
  endpoint; serializes single vs. multi reference images and
  enforces the refs+N <= 15 limit; surfaces optimize_prompt_mode
  / web_search / output_format via llm.WithExtra.

- sdkx/llm/qwen/image — registers provider key "qwen-image" with
  the Qwen-Image 2.0 Pro / 2.0 / Max / Plus / qwen-image lineup;
  targets DashScope's
  /api/v1/services/aigc/multimodal-generation/generation endpoint;
  defaults to the Beijing region (https://dashscope.aliyuncs.com)
  with Singapore reachable via base_url override; rejects
  PartImage inputs with a typed validation error since image
  editing is on the separate qwen-image-edit endpoint not yet
  adapted.

Each adapter ships with its own DisabledCaps profile (CapVision
+ CapImageOutput on, all chat-completion knobs off), structured
errdefs error mapping for the provider's documented error codes,
gofmt-stable doc.go, and unit tests against an httptest server.

Bumps the sdk dependency to v0.2.8 to pick up the CapImageOutput
/ CapAudioOutput / ImageGenOptions / NewOneChunkStream surface.

Co-authored-by: Cursor <cursoragent@cursor.com>
sdkx now requires sdk v0.2.8 (PR #71); the local replace makes the
e2e module pick up that requirement transitively, so its indirect
line needs syncing. CI was failing the 'go: updates to go.mod
needed' check before this.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ed versions

Only replace modules that have no published version we can pin
against. sdk / sdkx / vessel are all published, so the e2e suite
should depend on their tagged versions and treat in-flight
library PRs as out-of-scope.

Without this, every sdkx PR (e.g. #72 adding image adapters)
would also need to bump the indirect sdk version pinned in this
go.mod just to keep CI green — the canonical 'cross-module bleed'
the auto-tag workflow already tries to prevent.

cmd/vesseld stays replaced because it is intentionally never
tagged as a Go module (ships as a binary, see auto-tag.yml).

Co-authored-by: Cursor <cursoragent@cursor.com>
@lIang70
lIang70 merged commit 1778a94 into main May 7, 2026
13 checks passed
@lIang70
lIang70 deleted the feat/sdkx-image-adapters branch May 7, 2026 10:41
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