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

# OpenCode

> Run OpenCode on RedPill through Private AI Proxy, or configure it by hand.

OpenCode speaks Chat Completions. Private AI Proxy configures it automatically.

## With Private AI Proxy

1. Install [Private AI Proxy](/get-started/private-ai-proxy), sign in, and turn on **Protected**.
2. On the **Agents** screen, connect **OpenCode**.
3. Restart OpenCode.

The app writes the provider into `opencode.json` with an agent-scoped token for its local API, and
restores the file when you disconnect or stop Protected.

From the CLI, the same connection is:

```bash theme={null}
pap agents connect opencode
```

## Without the Proxy

Install the RedPill plugin (OpenCode 1.18.24 or newer), restart OpenCode, then sign in and pick a
model in its TUI. Omit `--global` for a project installation.

```bash theme={null}
opencode plugin opencode-provider-redpill --global
```

```text theme={null}
/connect
# select RedPill AI and enter your API key
/models
# search for redpill/ and choose a model
```

OpenCode keeps the plugin configuration and key in its own stores; do not add a separate
`provider.redpill` block. `REDPILL_AI_API_KEY` supplies the key for one process.

This plugin verifies ACI inside OpenCode: attestation and every response receipt are checked
automatically, and `/redpill-attestation`, `/redpill-receipts`, `/redpill-receipt`, and
`/redpill-session` show the evidence.

## Check the connection

Run `/models` and confirm a `redpill/` model is selected, then run one bounded tool task.

## Troubleshooting

| Symptom                           | Check                                                                                             |
| --------------------------------- | ------------------------------------------------------------------------------------------------- |
| OpenCode ignores the Proxy        | Confirm **Connected** in the app and that Protected is on, then restart OpenCode.                 |
| RedPill is absent from `/connect` | Run `opencode debug config` and confirm `opencode-provider-redpill` is in `plugin`, then restart. |
| No models appear                  | Run `opencode models redpill` and read the provider error.                                        |

## References

* [OpenCode providers](https://opencode.ai/docs/providers/)
* [OpenCode plugins](https://opencode.ai/docs/plugins/)
* [RedPill model catalog](/api-reference/models)
