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

# Pi

> Run OpenCode Go-, Aster-, or OpenRouter-backed Pi coding agents in Replicas workspaces.

Replicas supports [Pi](https://pi.dev) as an SDK-backed coding agent. Pi runs inside the workspace VM, uses OpenCode Go, Aster, or OpenRouter for inference, and persists its session and tool history across turns.

## Setup

Pi and Opencode share OpenCode Go and Aster credentials. [DeepSeek Harness](/features/coding-agents/deepseek), Pi, and Opencode share OpenRouter credentials. Authentication priority is OpenCode Go, Aster, then OpenRouter.

1. Create an OpenCode Go API key in [OpenCode Zen](https://opencode.ai/zen), an Aster key in the [Aster console](https://console.asterlab.ai/), or an OpenRouter key on the [OpenRouter keys page](https://openrouter.ai/keys).
2. Paste it under **Pi → OpenCode Go**, **Pi → Aster API Key**, or **Pi → OpenRouter API Key** in [Organization → Coding Agents](https://replicas.dev/dashboard/agents). The credentials are shared with the other supported harnesses.
3. Set organization credentials for the team, or add a personal key under **Personal** to override the organization default.

See [Credentials](/admin/credentials) for credential scope and fallback behavior.

## Models

With OpenCode Go connected, Pi provides the active models from the OpenCode Go catalog. With Aster connected, Pi provides `kimi-k3`, `glm-5.2`, `gpt-oss-120b-fast`, and `gpt-oss-120b`.

With OpenRouter, Pi offers the models enabled under **Pi → OpenRouter models** in [Coding Agents settings](https://replicas.dev/dashboard/agents). Organization admins pick these from the connected OpenRouter account, and the selection is shared with [DeepSeek Harness](/features/coding-agents/deepseek#models) and [Opencode](/features/coding-agents/opencode#models). Until it is changed, Pi provides:

| Model ID                        | Label            | Notes                        |
| ------------------------------- | ---------------- | ---------------------------- |
| `z-ai/glm-5.3`                  | GLM 5.3          | Default                      |
| `deepseek/deepseek-v4-pro-0813` | DeepSeek V4 Pro  | Flagship V4 coding model     |
| `moonshotai/kimi-k3`            | Kimi K3          | Multimodal coding model      |
| `google/gemini-3.8-flash`       | Gemini 3.8 Flash | Fast multimodal Google model |

Enable additional models under **OpenRouter models** in [Coding Agents settings](https://replicas.dev/dashboard/agents). Saved organization selections take precedence over these defaults.

Choose an organization default under [Defaults](/admin/defaults), a personal default in account preferences, or a model for the active chat from the workspace composer.

## Using Pi in Workspaces

Choose **Pi** from the composer's harness/model picker when creating a chat. Pi can:

* Read, write, and edit repository files
* Run shell commands with Replicas command protection
* Accept image attachments
* Persist sessions and tool history across workspace sleep
* Use MCP servers configured for the organization
* Discover provisioned and repository skills through Pi's global `.agents/skills` directory
* Run skills explicitly with `/skill:<name>`

Pi does not currently provide native plan-mode, fast-mode, or goal-mode support. Ask Pi for a read-only implementation plan in the prompt when you want planning without changes.

### Provider errors

When inference fails upstream, the chat reports the provider, model, HTTP status, and any response detail the provider returned. Transient server errors add a retry hint; Pi already retries them automatically before the turn fails.

## Programmatic Use

Select Pi anywhere Replicas accepts a coding agent:

| Surface                              | How to choose Pi                                                      |
| ------------------------------------ | --------------------------------------------------------------------- |
| [CLI](/features/cli)                 | `-a pi` on `replicas create` and `replicas send`                      |
| [API](/features/api)                 | `"coding_agent": "pi"` on create and message requests                 |
| [MCP](/features/mcp)                 | `"coding_agent": "pi"` on `create_replica` and `send_replica_message` |
| [Automations](/features/automations) | Set **Coding agent** to Pi in the automation editor                   |
| [Defaults](/admin/defaults)          | Select Pi as the organization or personal default coding agent        |

```bash theme={null}
replicas create fix-tests \
  -e backend \
  -a pi \
  -m "Inspect the repository and fix the failing tests"
```

```bash theme={null}
curl -X POST "https://api.replicas.dev/v1/replica" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "fix-tests",
    "environment_id": "ENVIRONMENT_UUID",
    "message": "Inspect the repository and fix the failing tests",
    "coding_agent": "pi",
    "model": "z-ai/glm-5.3"
  }'
```
