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

# Connect OpenCode

> Configure OpenCode to use UncensoredGPT models through a custom OpenAI-compatible provider.

[OpenCode](https://opencode.ai) is a free, open-source AI coding agent for your terminal ([documentation](https://opencode.ai/docs)). It connects to UncensoredGPT as a custom OpenAI-compatible provider. Setup takes about a minute.

## 1. Set your API key

Create a key in the [Console](https://console.uncensoredgpt.ai) if you don't have one, then export it:

```bash theme={null}
export UNCENSOREDGPT_API_KEY="sk-..."
```

Add the export to your shell profile (`~/.bashrc`, `~/.zshrc`, …) to make it permanent.

## 2. Add the provider to your OpenCode config

Mac / Linux: `~/.config/opencode/opencode.json`

Windows: `%USERPROFILE%\.config\opencode\opencode.json`

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "model": "uncensoredgpt/uncensoredgpt/qwen3.8-27b-uncensored",
  "provider": {
    "uncensoredgpt": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "UncensoredGPT",
      "options": {
        "baseURL": "https://api.uncensoredgpt.ai/v1",
        "apiKey": "{env:UNCENSOREDGPT_API_KEY}"
      },
      "models": {
        "uncensoredgpt/qwen3.8-27b-uncensored": {
          "name": "Qwen3.8 27B Uncensored",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/qwen3.6-35b-a3b-uncensored": {
          "name": "Qwen3.6 35B A3B Uncensored",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/gemma4-31b-uncensored": {
          "name": "Gemma4 31B Uncensored",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/gemma4-26b-a4b-uncensored": {
          "name": "Gemma4 26B A4B Uncensored",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/uncensoredgpt": {
          "name": "UncensoredGPT",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/qwen3.8-flash-next-cybersecurity": {
          "name": "Qwen3.8 Flash Next Cybersecurity",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/deepseek-v4.1-flash-uncensored": {
          "name": "DeepSeek V4.1 Flash Uncensored",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/glm-5.3-flash-uncensored": {
          "name": "GLM 5.3 Flash Uncensored",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/glm-5.3-uncensored": {
          "name": "GLM 5.3 Uncensored",
          "tool_call": true,
          "reasoning": true
        },
        "uncensoredgpt/neuralnet-free-model": {
          "name": "NeuralNet Free Model",
          "tool_call": true,
          "reasoning": false
        }
      }
    }
  }
}
```

## 3. Start OpenCode

```bash theme={null}
cd /path/to/your/project
opencode
```

The provider appears as **UncensoredGPT** in the `/models` picker, and the `model` field in the config above makes `uncensoredgpt/qwen3.8-27b-uncensored` your default.

## How model references work

OpenCode addresses models as `<provider>/<model-id>`. Because our model IDs already contain a slash (`uncensoredgpt/...`), the full reference has three segments:

```bash theme={null}
opencode --model uncensoredgpt/uncensoredgpt/glm-5.3-flash-uncensored
```

The **first** segment is the provider key from your config (`uncensoredgpt`); the **rest** is the model ID exactly as the API expects it. Same pattern as OpenRouter-style IDs.

## Notes

* `{env:UNCENSOREDGPT_API_KEY}` reads the key from the environment at runtime, so the key itself never lands in the config file.
* You can trim the `models` map to just the models you use.
* Context windows per model are listed on the [coding agents overview](https://docs.uncensoredgpt.ai/api-reference/agents.md). If you want OpenCode to know a model's context limit explicitly, add a `limit` object — OpenCode requires both `context` and `output` values there, so only add it if you know your output cap.
* All models support tool calling and streaming, so agent features work fully.


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