> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trynito.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCode

> Add Nito as a custom OpenAI-compatible provider in OpenCode.

Create an API key in the [developer console](/web-app/developer-console). Choose a model ID from the [catalog](/models/all-models). OpenCode needs a provider entry because Nito's models are outside OpenCode's built-in list.

## Configure the provider

Put the key in the environment of the shell that starts OpenCode:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export NITO_API_KEY="z_sk_your_key_here"
```

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "nito": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Nito",
      "options": {
        "baseURL": "https://app.trynito.ai/v1",
        "apiKey": "{env:NITO_API_KEY}"
      },
      "models": {
        "moonshotai/kimi-k3": { "name": "Kimi K3" }
      }
    }
  }
}
```

Save the JSON in `~/.config/opencode/opencode.json` for your own sessions, or in the project's `opencode.json` when the project owns this provider definition. The key stays in `NITO_API_KEY`; the project file contains only its environment-variable reference. The `npm` adapter uses Chat Completions, so `baseURL` ends at `/v1` rather than `/v1/chat/completions`.

## Check the route

Start OpenCode and select `nito/moonshotai/kimi-k3` from `/models`. Ask for a one-sentence reply, then try a small edit that uses OpenCode's tools. The `nito/` prefix is OpenCode's provider ID; Nito receives `moonshotai/kimi-k3`.

Add another catalog ID as a key under `models` before selecting it. For Confidential inference, add the exact `:confidential` catalog ID as a separate model entry. OpenCode's provider configuration does not implement the client-side encryption required for Encrypted inference.

## Troubleshooting

* If Nito is absent from `/models`, check the config file location and JSON syntax, then restart OpenCode.
* If the model appears but authorization fails, confirm `NITO_API_KEY` is exported in the process that launched OpenCode. A project config file does not set that variable for you.
* If the endpoint returns 404, check that `baseURL` ends in `/v1` and that the model key matches a catalog ID exactly.
* If text works but edits fail, choose a catalog model whose `supported_parameters` includes `tools`. Check the live catalog.

OpenCode's [custom-provider guide](https://opencode.ai/docs/providers/#custom-provider) documents the config fields and environment-variable syntax.

## Related

* [Editor Integrations](/api/sdks/editor-integrations)
* [Privacy Levels](/privacy/levels)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.