feat(providers): add Kimi (Moonshot), GLM (Zhipu), DeepSeek - #80
Merged
Conversation
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.
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.
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 ( |
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.
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 theshared
openai.pytranslation. Closes #72, #73, #74.Scope
composition.py), tests, docsNone, same rationale as Provider: OpenAI-compatible provider seam (+ Grok/xAI reference) #71), Gemini (Spike: Gemini id-less tool-call loop (native vs OpenAI-compat) #76/Provider: add Gemini (Google, native generateContent) #77)Changes
composition.OPENAI_COMPATIBLEgains three rows:moonshot→https://api.moonshot.ai/v1·MOONSHOT_API_KEYzhipu→https://api.z.ai/api/paas/v4·ZHIPUAI_API_KEY(international Z.AI host; Chinaopen.bigmodel.cn/api/paas/v4noted in a comment)deepseek→https://api.deepseek.com·DEEPSEEK_API_KEYapplication/loop.pyuntouched.Testing
make_gatewaytest pins every compat provider'sexact
(base_url, env_var)— a wrong host is the real risk, so it's asserted explicitly, not leftto the shared construction path.
deepseek_reasoner.jsonfixture (tool call +reasoning_content) provesfrom_wireextracts the tool call and ignores the chain-of-thought — the one genuine wiredifference in this batch.
openaitranslationtests. 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 checkpasses locallymake arch)unittest.mockoutsidetests/contracts/Scope discipline
Public contracts
provider:values, not a schema changeDocs
docs/Progress.mdupdated (Provider: add Kimi (Moonshot) #72/Provider: add GLM (Zhipu) #73/Provider: add DeepSeek #74 code-complete)docs/Learnings.md— no new pitfall beyond the Provider: OpenAI-compatible provider seam (+ Grok/xAI reference) #71 entryRisks
covered by the wiring test. The live path in CI/dev remains OpenRouter (Provider: OpenAI-compatible provider seam (+ Grok/xAI reference) #71).
None).Follow-ups
openai_compatible(user-suppliedbase_url).