Photo of DeepakNess DeepakNess

Run NVIDIA Kimi K2.6 and others in OpenCode

I wanted to use Kimi K2.6 from NVIDIA inside OpenCode, and it was simpler than I first thought. This and a bunch of other open-source models are free to try in NVIDIA, by the way.

I only had to add the API key, model details, and the correct base URL in the OpenCode config.

I wanted to try Kimi K2.6 but you can try other models as well. For Kimi, NVIDIA's model name is:

moonshotai/kimi-k2.6

But inside OpenCode, I had use it like below

nvidia/moonshotai/kimi-k2.6

I edited this file on my macOS device:

~/.config/opencode/opencode.jsonc

And added this config:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "nvidia/moonshotai/kimi-k2.6",
  "provider": {
    "nvidia": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "NVIDIA",
      "api": "https://integrate.api.nvidia.com/v1",
      "options": {
        "baseURL": "https://integrate.api.nvidia.com/v1",
        "apiKey": "YOUR_NVIDIA_API_KEY_HERE",
        "timeout": 600000,
        "chunkTimeout": 60000,
        "extraBody": {
          "chat_template_kwargs": {
            "thinking": true
          }
        }
      },
      "models": {
        "moonshotai/kimi-k2.6": {
          "name": "Kimi K2.6",
          "reasoning": true,
          "tool_call": true,
          "temperature": true,
          "attachment": true,
          "interleaved": {
            "field": "reasoning_content"
          },
          "modalities": {
            "input": ["text", "image", "video"],
            "output": ["text"]
          },
          "limit": {
            "context": 262144,
            "output": 65536
          },
          "options": {
            "chat_template_kwargs": {
              "thinking": true
            }
          }
        }
      }
    }
  }
}

The important bit is this URL:

https://integrate.api.nvidia.com/v1

NVIDIA's example uses the full /chat/completions URL, but OpenCode only needs the base URL. It adds /chat/completions by itself.

Works as expected, so that's it.

Webmentions

What’s this?