# OpenCode — Uncensured AI

Operational guide for AI assistants and people. Reading requires neither JavaScript nor authentication.

- HTML: https://uncensuredai.com/en/guides/opencode
- Markdown: https://uncensuredai.com/en/guides/opencode.md
- Complete index: https://uncensuredai.com/llms.txt

## Prerequisites

You need an Uncensured AI account, credit and your own key from https://uncensuredai.com/keys. An OpenAI key will not work. If missing, ask the user to set it locally; do not create or search for keys in other accounts. Before editing, check OS, client version and active profile. Merge settings without overwriting existing providers, preferences or credentials.

## Connection values

- Base URL: https://uncensuredai.com/v1
- Endpoint: POST https://uncensuredai.com/v1/chat/completions
- Authentication: Authorization: Bearer YOUR_UNCENSURED_API_KEY
- Environment variable: UNCENSURED_API_KEY
- Protocol: OpenAI-compatible Chat Completions
- Model ID example: glm-5.3-flash-abliterated

Do not duplicate `/v1`. Check models available to the key with GET /v1/models. Do not assume image, tool, reasoning support or a context size: these depend on the model and client. Consult the current catalog.

## Setup

First check `opencode --version`. Use only the installed version’s schema and merge this provider into existing configuration. Do not switch versions unless requested.

### OpenCode 1.x
Install if needed: `npm install -g opencode-ai`. File: `opencode.json` in the project directory.
```json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "uncensuredai/glm-5.3-flash-abliterated",
  "provider": {
    "uncensuredai": {
      "name": "Uncensured AI",
      "models": {
        "glm-5.3-flash-abliterated": {
          "name": "GLM 5.3 Flash Abliterated"
        },
        "glm-5.3-abliterated": {
          "name": "GLM 5.3 Abliterated"
        },
        "deepseek-v4.1-flash-abliterated": {
          "name": "DeepSeek V4.1 Flash Abliterated",
          "limit": {
            "context": 1048576,
            "output": 32768
          }
        },
        "deepseek-v4-pro-uncensored": {
          "name": "DeepSeek V4 Pro Uncensored"
        },
        "qwen3.8-max-uncensored": {
          "name": "Qwen 3.8 Max Uncensored"
        },
        "glm-5.3-flash-uncensored": {
          "name": "GLM 5.3 Flash Uncensored"
        },
        "deepseek-v4.1-flash-uncensored": {
          "name": "DeepSeek V4.1 Flash Uncensored"
        }
      },
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://uncensuredai.com/v1",
        "apiKey": "{env:UNCENSURED_API_KEY}"
      }
    }
  }
}
```

### OpenCode 2.x
Install if needed: `npm install -g @opencode/cli`. File: `opencode.jsonc` in the project directory.
```jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "model": "uncensuredai/glm-5.3-flash-abliterated",
  "providers": {
    "uncensuredai": {
      "name": "Uncensured AI",
      "models": {
        "glm-5.3-flash-abliterated": {
          "name": "GLM 5.3 Flash Abliterated"
        },
        "glm-5.3-abliterated": {
          "name": "GLM 5.3 Abliterated"
        },
        "deepseek-v4.1-flash-abliterated": {
          "name": "DeepSeek V4.1 Flash Abliterated",
          "limit": {
            "context": 1048576,
            "output": 32768
          }
        },
        "deepseek-v4-pro-uncensored": {
          "name": "DeepSeek V4 Pro Uncensored"
        },
        "qwen3.8-max-uncensored": {
          "name": "Qwen 3.8 Max Uncensored"
        },
        "glm-5.3-flash-uncensored": {
          "name": "GLM 5.3 Flash Uncensored"
        },
        "deepseek-v4.1-flash-uncensored": {
          "name": "DeepSeek V4.1 Flash Uncensored"
        }
      },
      "env": [
        "UNCENSURED_API_KEY"
      ],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://uncensuredai.com/v1"
      }
    }
  }
}
```
Read the key from the process environment (`UNCENSURED_API_KEY`), not the JSON file. Start `opencode`, use `/models` and select an `uncensuredai/<model-id>` model. HTTP requests use only `<model-id>`, without the `uncensuredai/` prefix.

OpenCode 2.x: https://opencode.ai/v2/docs/providers/

## Local key

`YOUR_UNCENSURED_API_KEY` is a placeholder. Set the actual value only on your device. macOS/Linux, in the terminal session:
```sh
export UNCENSURED_API_KEY="YOUR_UNCENSURED_API_KEY"
```

Windows PowerShell:

```powershell
$env:UNCENSURED_API_KEY="YOUR_UNCENSURED_API_KEY"
```
These commands apply to the current session. For persistence use a credential store or a local file excluded from Git, accessible only to its owner. Never echo the key into logs, screenshots, public prompts, URLs, reports or commits. Do not send it to third parties; Authorization must go only to https://uncensuredai.com. GUI apps may not inherit terminal variables: use their credential field.

## Verify without generating tokens

GET /v1/models

Save as `verify_uncensured.py` and run with Python 3 in the same key environment. It requires no dependencies and generates no completions. Check that the chosen ID is listed. It does not print the key:
```python
import json, os, urllib.request

key = os.environ["UNCENSURED_API_KEY"]
request = urllib.request.Request(
    "https://uncensuredai.com/v1/models",
    headers={"Authorization": "Bearer " + key},
)
with urllib.request.urlopen(request, timeout=30) as response:
    models = json.load(response)
print("Available model IDs:")
for item in models["data"]:
    print(item["id"])
```

## Optional API example: uses credit

Run only if the user authorized a generation. Install the Python SDK with `python -m pip install openai` in the project environment.
```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["UNCENSURED_API_KEY"],
    base_url="https://uncensuredai.com/v1",
)
response = client.chat.completions.create(
    model="glm-5.3-flash-abliterated",
    messages=[{"role": "user", "content": "Ciao!"}],
    max_tokens=4096,
)
print(response.choices[0].message.content)
```

## Models and pricing

- `glm-5.3-flash-abliterated` — GLM 5.3 Flash Abliterated
- `glm-5.3-abliterated` — GLM 5.3 Abliterated
- `deepseek-v4.1-flash-abliterated` — DeepSeek V4.1 Flash Abliterated
- `deepseek-v4-pro-uncensored` — DeepSeek V4 Pro Uncensored
- `qwen3.8-max-uncensored` — Qwen 3.8 Max Uncensored
- `glm-5.3-flash-uncensored` — GLM 5.3 Flash Uncensored
- `deepseek-v4.1-flash-uncensored` — DeepSeek V4.1 Flash Uncensored

The list above is the site selection, not a guarantee of availability for every key. Current catalog and per-million-token rates (input, output and cache separately): https://uncensuredai.com/en/pricing

## Troubleshooting

- 401: missing, invalid or incorrect key; check the process receives it without displaying it.
- 403: check key permissions and restrictions.
- Insufficient credit: check account balance and limits; do not bypass prepaid billing.
- Model not found: use the exact ID returned by GET /v1/models.
- 404: check Base URL and path; avoid `/v1/v1` and the Responses endpoint in OpenCat.
- finish_reason=length: the output budget is exhausted; increase it or reduce reasoning. Reasoning also consumes tokens and is billed on actual usage, even without a final answer. Do not automatically repeat the same request. The example budget is not a guaranteed minimum.
- 429: respect Retry-After, wait and limit retries; no aggressive loops.
- Unsupported tools or context: check model capabilities; do not invent values.
- Required UI actions are unavailable to the agent: explain only the remaining steps and do not claim setup is complete.

## Data and scope

Uncensured AI does not retain prompts and responses on its own servers. Web chat history stays on the device. Account and billing data are separate. Third-party apps and agents may store conversations, files, logs or backups locally or in their own services: this guide does not change their policies.

https://uncensuredai.com/en/zero-retention

## Official client documentation

https://opencode.ai/docs/providers/

## Report the result

Report app and version, modified paths without secrets, selected provider and model, model-list verification result and any remaining manual steps. Distinguish connectivity from a real generated response; never claim a test you did not run.
