opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]:https://api.kimi.com/coding/ support

Open oldschoola opened this issue 1 month ago • 10 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

https://www.kimi.com/coding/docs/en/third-party-agents.html

oldschoola avatar Nov 09 '25 12:11 oldschoola

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

  • #3178: Add n1n.ai API as a model provider (similar request for adding a new API provider)
  • #2578: Feature Request: Add CometAPI Provider Support (similar API provider addition request)
  • #2933: Add Nebius Ai Studio Models Support (similar provider support request)
  • #3347: Add support for vultr as it has openai compatible api calls (closed, but was similar request that also mentioned Kimi support)

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Nov 09 '25 12:11 github-actions[bot]

@oldschoola Try use this for your opencode.json

{
  "$schema": "https://opencode.ai/config.json",
    "provider": {
      "kimi": {
        "npm": "@ai-sdk/openai-compatible",
        "name": "Kimi",
        "options": {
          "baseURL": "https://api.kimi.com/coding/",
          "apiKey": "<your-kimi-api-key>"
        },
        "models": {
          "kimi-for-coding": {
            "name": "Kimi for Coding",
            "limit": {
              "context": 262144,
              "output": 32768
            }
          }
        }
      }
    }
}

OpeOginni avatar Nov 09 '25 14:11 OpeOginni

Thanks @OpeOginni for the config. I'm getting The requested resource was not found as response in the session. Any idea why?

JanOwiesniak avatar Nov 13 '25 13:11 JanOwiesniak

No problem @JanOwiesniak . That issue could be cause of the name of the model you put, confirm that its correct, with the casing and hyphens kimi-for-coding

OpeOginni avatar Nov 13 '25 20:11 OpeOginni

@oldschoola Try use this for your opencode.json

{ "$schema": "https://opencode.ai/config.json", "provider": { "kimi": { "npm": "@ai-sdk/openai-compatible", "name": "Kimi", "options": { "baseURL": "https://api.kimi.com/coding/", "apiKey": "" }, "models": { "kimi-for-coding": { "name": "Kimi for Coding", "limit": { "context": 262144, "output": 32768 } } } } } }

Almost works for me. I think the base url needs to have v1 at the end ("baseURL": "https://api.kimi.com/coding/v1",).

However, am running into an annoying: ERROR 2025-11-23T17:59:40 +1ms service=tui message=Access terminated statusCode=403 API error

Fozzyack avatar Nov 23 '25 18:11 Fozzyack

This is working for me in opencode.

  "provider": {
    "kimi-for-coding": {
      "npm": "@ai-sdk/anthropic",
      "name": "Kimi For Coding",
      "options": {
        "baseURL": "https://api.kimi.com/coding/v1"
      },
      "models": {
        "kimi-for-coding: {
          "name": "Kimi For Coding",
          "limit": {
            "context": 262144,
            "output": 32768
          }
        }
      }
    }
  }

in auth.json

  "kimi-for-coding": {
    "type": "api",
    "key": "sk-kimi-..."
  }

https://www.kimi.com/coding/docs/en/third-party-agents.html

briansunter avatar Nov 28 '25 10:11 briansunter

@briansunter working for me! I should've known to try use the anthropic sdk.

Fozzyack avatar Nov 28 '25 10:11 Fozzyack

PR welcome if anyone wants to add it to models.dev

rekram1-node avatar Dec 01 '25 04:12 rekram1-node

Just added it here @rekram1-node https://github.com/sst/models.dev/pull/459

briansunter avatar Dec 02 '25 06:12 briansunter

merged!

it should deploy shortly and then everything should work as expected

rekram1-node avatar Dec 02 '25 07:12 rekram1-node