Skip to content

feat(providers): add Kimi (Moonshot), GLM (Zhipu), DeepSeek - #80

Merged
csmatar merged 2 commits into
mainfrom
feat/compat-providers-kimi-glm-deepseek
Aug 3, 2026
Merged

feat(providers): add Kimi (Moonshot), GLM (Zhipu), DeepSeek#80
csmatar merged 2 commits into
mainfrom
feat/compat-providers-kimi-glm-deepseek

Conversation

@csmatar

@csmatar csmatar commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add three OpenAI-compatible providers — Kimi (Moonshot), GLM (Zhipu), DeepSeek — as
registry rows on the seam from #71. No adapter code: each is (base_url, env_var) data reusing the
shared openai.py translation. Closes #72, #73, #74.

Scope

Changes

  • composition.OPENAI_COMPATIBLE gains three rows:
    • moonshothttps://api.moonshot.ai/v1 · MOONSHOT_API_KEY
    • zhipuhttps://api.z.ai/api/paas/v4 · ZHIPUAI_API_KEY (international Z.AI host; China
      open.bigmodel.cn/api/paas/v4 noted in a comment)
    • deepseekhttps://api.deepseek.com · DEEPSEEK_API_KEY
  • Base URLs verified against each provider's current OpenAI-compatibility docs (Aug 2026).
  • No changes above the port; application/loop.py untouched.

Testing

make check          # lint + typecheck + arch + test — all green
# 592 passed, 3 skipped (live), coverage 93.30% (floor 92%)
  • Per-provider data contract: a parametrized make_gateway test pins every compat provider's
    exact (base_url, env_var) — a wrong host is the real risk, so it's asserted explicitly, not left
    to the shared construction path.
  • DeepSeek reasoner: a deepseek_reasoner.json fixture (tool call + reasoning_content) proves
    from_wire extracts the tool call and ignores the chain-of-thought — the one genuine wire
    difference in this batch.
  • Kimi / GLM chat are wire-identical to OpenAI, already covered by the shared openai translation
    tests. I did not manufacture duplicate per-provider tool-call fixtures — a byte-identical copy
    of the OpenAI fixture adds no signal, and real native payloads need direct keys (an OpenRouter
    capture would already be normalized to OpenAI shape, so it wouldn't catch native quirks). Flag if
    you'd rather have literal per-provider fixtures anyway.

Quality gate

  • make check passes locally
  • New/changed tests run offline — no network, no API key
  • Architecture contracts kept (make arch)
  • No unittest.mock outside tests/contracts/
  • Ubiquitous language respected (ARCHITECTURE §3)

Scope discipline

  • Nothing further-deferred built
  • No ARCHITECTURE §11 tripwires

Public contracts

  • Exit codes unchanged
  • YAML suite format unchanged — new provider: values, not a schema change
  • Trace JSON shape unchanged

Docs

Risks

Follow-ups

Three OpenAI-compatible providers as registry rows on the #71 seam — no adapter
code, each is (base_url, env_var) data reusing the openai.py translation. Base
URLs verified against current provider docs. A parametrized make_gateway test pins
every provider's exact wiring; a deepseek-reasoner fixture proves from_wire ignores
reasoning_content while extracting the tool call.

Closes #72, #73, #74.
@csmatar csmatar added this to the v0.4 Model Breadth milestone Aug 3, 2026
@csmatar csmatar added enhancement New feature or request provider Model provider / adapter support labels Aug 3, 2026
OpenRouter normalizes provider responses to OpenAI shape, so our offline fixtures
and the OpenRouter live path can't prove native wire quirks for direct-key users.
Point the registry and the compat contract test at the tracking issue.
@csmatar

csmatar commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up filed: #81 tracks capturing real native per-provider payloads for the direct-key path. The blind spot is that OpenRouter (our live path) normalizes every response to OpenAI shape, so no OpenRouter-sourced fixture can reveal a provider's native quirks — only a direct-key capture can. This PR now points at #81 from both the registry (composition.py) and the compat contract test, so the boundary is discoverable in code. Ships the OpenRouter path now; closes the direct path deliberately later.

@csmatar
csmatar merged commit c42a4db into main Aug 3, 2026
5 checks passed
@csmatar
csmatar deleted the feat/compat-providers-kimi-glm-deepseek branch August 3, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request provider Model provider / adapter support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provider: add Kimi (Moonshot)

1 participant