feat: support OpenAI-compatible providers (Kimi, DeepSeek) with chat-completions API#18054
Closed
yandong2023 wants to merge 2 commits intoanomalyco:devfrom
Closed
feat: support OpenAI-compatible providers (Kimi, DeepSeek) with chat-completions API#18054yandong2023 wants to merge 2 commits intoanomalyco:devfrom
yandong2023 wants to merge 2 commits intoanomalyco:devfrom
Conversation
Add apiType configuration option to allow providers to specify which API endpoint to use. - Add apiType field to ModelsDev.Provider schema - Modify getModel to route to appropriate API based on apiType - Default behavior unchanged for backward compatibility This enables support for Kimi, DeepSeek, and other providers that only implement /v1/chat/completions. Fixes anomalyco#18050
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
- Add apiType field to ModelsDev.Provider schema - Modify getLanguage to route to appropriate API based on apiType - Merge with latest upstream/dev changes - Default behavior unchanged for backward compatibility
a77f088 to
2401704
Compare
6 tasks
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.
Issue for this PR
Closes #18050
Type of change
What does this PR do?
OpenCode uses /v1/responses endpoint by default, but many popular providers (Kimi, DeepSeek, Gemini via OpenAI-compatible mode) only support /v1/chat/completions, resulting in 404 or authentication errors.
This PR adds an apiType configuration option to allow providers to specify which API endpoint to use.
Changes:
Why this works:
When apiType is set to chat-completions, the provider uses sdk.languageModel() directly instead of the custom getModel function that calls responses API. This allows OpenAI-compatible providers like Kimi and DeepSeek to work correctly.
How did you verify your code works?
Checklist