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

# Use in Agents

> Connect coding agents to Private AI through Private AI Proxy, or configure an OpenAI-compatible endpoint directly.

[Private AI Proxy](https://docs.phala.com/phala-cloud/confidential-ai/agents/private-ai-proxy.md) verifies the Phala gateway on your machine and connects your agents to a local API. Agents receive a local token instead of your Phala credential. Tools can also connect to Phala directly.

## Connect an Agent

**1. Install Private AI Proxy and Sign In**

[Install the desktop app or CLI](https://docs.phala.com/phala-cloud/confidential-ai/agents/private-ai-proxy.md#install). Add a profile and choose **Phala**. Sign in with a Phala account or paste a key from **Private AI → API Keys** in the [Phala dashboard](https://cloud.phala.com/dashboard).

**2. Turn On Protected**

The app verifies the gateway's attestation and pins the channel before sending model traffic. Signed response receipts are audited after delivery.

**3. Connect the Agent**

On the **Agents** screen, connect the agent and restart it. The app writes its Local API into the agent's provider settings; disconnecting restores the previous settings.

| Agent | What Changes | Guide |
| - | - | - |
| Claude Code | Messages provider in `~/.claude/settings.json` | [Claude Code](https://docs.phala.com/phala-cloud/confidential-ai/agents/claude-code.md) |
| Codex | Custom Responses provider in `~/.codex/config.toml` | [Codex CLI](https://docs.phala.com/phala-cloud/confidential-ai/agents/codex.md) |
| DeepSeek Harness | `~/.dsh/cordis.patch.yml` and `.credentials.yaml` | |
| OpenCode | Provider in `~/.config/opencode/opencode.json` | [OpenCode](https://docs.phala.com/phala-cloud/confidential-ai/agents/opencode.md) |
| Pi | Provider in `~/.pi/agent/models.json` | [Pi](https://docs.phala.com/phala-cloud/confidential-ai/agents/pi.md) |
| Hermes | Provider in `~/.hermes/config.yaml` | [Hermes](https://docs.phala.com/phala-cloud/confidential-ai/agents/hermes.md) |
| OpenClaw | Native-host provider; restart required | [OpenClaw](https://docs.phala.com/phala-cloud/confidential-ai/agents/openclaw.md) |
| Oh My Pi | Local token and models file; restart `omp` | |

From the CLI, sign in and start protection before connecting an agent:

```bash theme={"system"}
pap profiles login work --provider phala
pap start --profile work
pap agents connect codex
```

See [Private AI Proxy CLI](https://docs.phala.com/phala-cloud/confidential-ai/agents/private-ai-proxy.md#cli) for API-key profiles and other commands.

## Other Tools

Tools with an OpenAI-compatible provider setting, such as [Cline](https://docs.phala.com/phala-cloud/confidential-ai/agents/cline.md), can use the Proxy's Local API while Protected is on:

| Field | Value |
| - | - |
| Base URL | `http://127.0.0.1:4180/v1` |
| API Key | The client key from the app's Overview screen |
| Model | `z-ai/glm-5.3`, or another chat model from the app's verified catalog |

See [Other Tools](https://docs.phala.com/phala-cloud/confidential-ai/agents/other-tools.md) for Continue, Zed, Copilot, Aider, Goose, and chat apps.

## Without the Proxy

On servers, in CI, or in frameworks, point the client at Phala directly. Every model on this endpoint runs in a TEE, but a base-URL configuration does not verify attestation locally. Use the [TypeScript ACI Verifier](https://docs.phala.com/phala-cloud/confidential-ai/verify/typescript-sdk.md) to enforce a verified channel in Node.js or Bun applications.

| Client | Protocol | Base URL |
| - | - | - |
| OpenAI clients and agent frameworks | Chat Completions | `https://inference.phala.com/v1` |
| Codex CLI and other Responses clients | Responses | `https://inference.phala.com/v1` |
| Claude Code and Anthropic clients | Messages | `https://inference.phala.com` (the client appends `/v1/messages`) |

For direct connections, create a key under **Private AI → API Keys** and export it in the client's shell:

```bash theme={"system"}
export PHALA_AI_API_KEY="YOUR_PHALA_API_KEY"
curl -s https://inference.phala.com/v1/models \
  | jq -r '.data[] | select((.supported_features // []) | index("tools")) | .id'
```

Use an exact chat-model ID such as `z-ai/glm-5.3` from [`/v1/models`](https://inference.phala.com/v1/models). For SDKs, observability tools, and gateways, see [Migration and Integrations](https://docs.phala.com/phala-cloud/confidential-ai/confidential-model/migration-and-integrations.md).


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