---
slug: "pi-ppq"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/cullendotdev/pi-ppq@main/README.md"
repo: "https://github.com/cullendotdev/pi-ppq"
source_file: "README.md"
branch: "main"
---
# pi-ppq — PayPerQ Provider for pi

Adds [PayPerQ](https://ppq.ai) as a model provider in pi, giving you access to 50+ LLM models including Claude, GPT, Grok, Gemini, DeepSeek, Qwen, and more — all billed per-token with no subscription.

Also includes PayPerQ's **smart routing models** (`auto`, `autoclaw/auto`, `autoclaw/eco`, `autoclaw/premium`) that automatically pick the best model for each prompt, cutting costs by up to 70%.

## Quick Start

**1. Get an API key** from your [PayPerQ dashboard](https://ppq.ai/api-docs) (it starts with `sk-`).

**2. Authenticate in pi** using the `/login` command:

```
/login
```

Select **PayPerQ** from the provider list, then paste your API key when prompted. pi stores it securely and uses it for all subsequent requests.

**3. Pick a model** with `/model` — look for entries prefixed `ppq/`:

```
/model ppq/claude-sonnet-4.6
/model ppq/auto
/model ppq/autoclaw/eco
```

> **Alternative:** You can also set the `PPQ_API_KEY` environment variable instead of using `/login`. See [Configuration](#configuration) for details.

## Available Models

Models are fetched live from the PayPerQ API every time pi starts. You always get the latest models and current pricing without updating the extension.

| Category | Examples | Pricing |
|----------|----------|---------|
| **Standard chat** | `claude-sonnet-4.6`, `gpt-5.5`, `grok-4.20`, `gemini-3-flash-preview`, `deepseek-v4-pro` | Per-token from PPQ API |
| **Routing models** | `auto`, `autoclaw`, `autoclaw/auto`, `autoclaw/eco`, `autoclaw/premium` | Dynamic (depends on selected model) |

Run `pi --list-models` to see the full list after setup.

## Routing Models

PayPerQ offers two types of smart routers that analyze your prompt and pick the right model automatically:

### `auto`

The general-purpose AI router. It scores your prompt and routes it to the best model for the job — simple questions go to fast/cheap models, complex reasoning to powerful ones. No configuration needed.

```
/model ppq/auto
```

### `autoclaw` (and variants)

Optimized for OpenClaw and coding agents. Available in three profiles:

| Model ID | Profile | Behavior |
|----------|---------|----------|
| `autoclaw` | Auto (balanced) | Same as `autoclaw/auto` — good quality at a fair price |
| `autoclaw/auto` | Auto (balanced) | Balanced quality and cost for each prompt tier |
| `autoclaw/eco` | Eco | Maximum cost savings — routes to the cheapest viable model |
| `autoclaw/premium` | Premium | Best quality — routes to top-tier models at every tier |

**How it works:** AutoClaw classifies your prompt across four tiers (Simple → Medium → Complex → Reasoning) and maps each tier to a different underlying model depending on the profile you chose. The routing happens server-side in under 1ms with no added latency.

## Configuration

### Authentication

**Primary method — `/login`:**

```
/login
```

Select **PayPerQ** from the list and enter your API key. pi saves it to its credential store and uses it automatically.

**Alternative — environment variable:**

```bash
export PPQ_API_KEY="sk-..."
```

When both are set, the environment variable takes precedence. This is useful for CI/CD pipelines or containerized environments where interactive login isn't practical.

### Model Updates

Models and pricing are fetched from `https://api.ppq.ai/v1/models` at startup. If the endpoint is unreachable the provider still registers (without models) and you can `/reload` later to pick them up. No manual updates needed.

## Troubleshooting

### "No models found for provider ppq"

The models endpoint was unreachable during startup. Check your network connection and run `/reload`.

### "No API key available"

No API key has been configured. Run `/login` and select **PayPerQ** to enter your key, or set the `PPQ_API_KEY` environment variable.

### "Unknown model" or 404 errors from the API

Some model IDs may have changed on PayPerQ's side. Run `/reload` to refresh the model list. If a model was removed entirely, pick another from the updated list.

### Routing model cost shows $0

Routing models (`auto`, `autoclaw`, etc.) show `$0` because their cost depends on which underlying model the router picks. The actual per-request cost is reported in pi's usage display after each response.
