Metadata-Version: 2.4
Name: llm-openuncensored
Version: 0.1.0
Summary: LLM plugin for uncensored and abliterated models hosted by OpenUncensored
Author: Dhruv Atreja
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/DhruvAtreja/llm-openuncensored
Project-URL: Changelog, https://github.com/DhruvAtreja/llm-openuncensored/releases
Project-URL: Issues, https://github.com/DhruvAtreja/llm-openuncensored/issues
Project-URL: CI, https://github.com/DhruvAtreja/llm-openuncensored/actions
Project-URL: OpenUncensored, https://openuncensored.com/
Keywords: llm,llm-plugin,uncensored,abliterated,openuncensored
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: llm>=0.26
Requires-Dist: httpx
Dynamic: license-file

# llm-openuncensored

[![PyPI](https://img.shields.io/pypi/v/llm-openuncensored.svg)](https://pypi.org/project/llm-openuncensored/)
[![Tests](https://github.com/DhruvAtreja/llm-openuncensored/actions/workflows/test.yml/badge.svg)](https://github.com/DhruvAtreja/llm-openuncensored/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/DhruvAtreja/llm-openuncensored/blob/main/LICENSE)

[LLM](https://llm.datasette.io/) plugin for uncensored and abliterated models hosted by [OpenUncensored](https://openuncensored.com/).

About: [OpenUncensored](https://openuncensored.com/) is one OpenAI compatible API for uncensored, abliterated and "heretic" open weight models (GLM, DeepSeek, Qwen, Gemma, Kimi, Hermes and more). Compare them on the [uncensored LLM leaderboard](https://openuncensored.com/uncensored-llm-leaderboard).

## Installation

Install this plugin in the same environment as LLM:

```bash
llm install llm-openuncensored
```

## Configuration

You need an OpenUncensored API key. Keys start with `ou-` and are prepaid at [openuncensored.com/credits](https://openuncensored.com/credits).

Save the key with LLM:

```bash
llm keys set openuncensored
# Paste your ou-... key here
```

Or set it as an environment variable:

```bash
export OPENUNCENSORED_KEY=ou-...
```

You can also pass a key for a single prompt with `--key ou-...`.

## Usage

Every chat model in the [OpenUncensored model list](https://api.openuncensored.com/v1/models) is registered with an `openuncensored/` prefix. To see them:

```bash
llm models | grep openuncensored
```

Run a prompt:

```bash
llm -m openuncensored/glm-5.3-flash-uncensored "Say hi in 3 words"
```

Responses stream by default. Use `--no-stream` to wait for the full reply.

Set a default model so you can leave out `-m`:

```bash
llm models default openuncensored/glm-5.3-flash-uncensored
llm "Write a limerick about a robot with no filter"
```

Start an interactive chat, with a system prompt and options:

```bash
llm chat -m openuncensored/kimi-k3.1-pro-uncensored \
  -s "You are a blunt code reviewer" \
  -o temperature 0.7 -o max_tokens 800
```

Run `llm models --options -q openuncensored` to see the options each model accepts (`temperature`, `max_tokens`, `top_p`, `stop`, `seed` and more).

### Images

Models tagged `vision` accept image attachments (PNG, JPEG, WebP and GIF):

```bash
llm openuncensored models --vision
llm -m openuncensored/inkling-2-mini-uncensored "Describe this image" -a photo.jpg
```

### Tools

Tool calling works with every model, using LLM's [tools support](https://llm.datasette.io/en/stable/tools.html):

```bash
llm -m openuncensored/glm-5.3-flash-uncensored -T llm_time "What time is it?" --td

llm -m openuncensored/glm-5.3-flash-uncensored \
  --functions 'def multiply(x: int, y: int) -> int: return x * y' \
  "What is 1234 times 5678?" --td
```

### Python API

```python
import llm

model = llm.get_model("openuncensored/glm-5.3-flash-uncensored")
# Uses the key from "llm keys set openuncensored" or OPENUNCENSORED_KEY,
# or set one directly with model.key = "ou-..."
response = model.prompt("Say hi in 3 words")
print(response.text())
```

Async models are available too, through `llm.get_async_model(...)`.

## Commands

List the chat models with their context length, tags and price per million tokens:

```bash
llm openuncensored models
llm openuncensored models --vision   # only models that accept images
llm openuncensored models --json     # full details as JSON
```

The model list is public, so listing models does not need a key. It is cached for one hour in `openuncensored_models.json` in the LLM user directory (`dirname "$(llm logs path)"`). To pick up new models right away:

```bash
llm openuncensored refresh
```

## Development

To set up this plugin locally, check out the code and create a virtual environment:

```bash
cd llm-openuncensored
python -m venv venv
source venv/bin/activate
```

Install the plugin with its test dependencies and run the tests:

```bash
pip install -e . --group dev
pytest
```

The tests mock all HTTP calls, so they need no key and no network access.
