Skip to content

Support OpenAI-compatible providers (Kimi, DeepSeek) with chat-completions API #18050

Closed as not planned

Description

@yandong2023

Problem

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 errors.

Affected Providers

  • Kimi (Moonshot): Returns 404 for /v1/responses - the endpoint does not exist
  • DeepSeek: Authentication fails due to endpoint mismatch
  • Gemini (OpenAI-compatible): Similar issues with endpoint compatibility

Error Examples

Kimi

POST https://api.moonshot.cn/v1/responses → 404 Not Found

DeepSeek

Unauthorized: Authentication Fails (governor)

Proposed Solution

Add apiType configuration option to allow providers to specify which API endpoint to use.

Example Configuration

{
  "provider": {
    "kimi": {
      "npm": "@ai-sdk/openai-compatible",
      "apiType": "chat-completions",
      "options": {
        "baseURL": "https://api.moonshot.cn/v1"
      }
    }
  }
}

Backward Compatibility

Default to apiType: "responses" to maintain existing behavior for OpenAI and other providers.

Workaround

Currently users have to use OpenAI-compatible SDK with custom configuration, but the model selection and provider detection don't work properly.

Related

This affects the growing ecosystem of OpenAI-compatible APIs in China and other regions where providers have not yet migrated to the responses API.

Environment

  • OpenCode version: 1.2.27
  • OS: Linux
  • Providers tested: Kimi (Moonshot), DeepSeek, Gemini

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 18, 2026
  2. github-actions commented on Mar 18, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • No issue template was used. This appears to be a feature request, but it doesn't use the Feature Request template (title should start with [FEATURE]:, and the template's verification checkbox and description fields must be filled in).

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. added a commit that references this issue on Mar 18, 2026
    d8f35db
  4. github-actions commented on Mar 18, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

  5. rekram1-node commented on Mar 18, 2026

    @rekram1-node
    Collaborator

    ai-sdk/openai-compatible doesn't support responses api, so that shouldn't happen unless u are using ai-sdk/openai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions