more-pi
OpenClaw-flavored pi wrapper that registers OpenClaw Codex models without patching pi packages
Package details
Install more-pi from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:more-pi- Package
more-pi- Version
0.1.26- Published
- Sep 21, 2026
- Downloads
- 456/mo · 16/wk
- Author
- guocity
- License
- MIT
- Types
- extension
- Size
- 202.5 KB
- Dependencies
- 2 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./dist/extension.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
more-pi
OpenClaw-flavored wrapper for pi. It launches @earendil-works/pi-coding-agent with an extension that registers OpenClaw Codex, Anthropic, and Ollama Cloud providers.
Usage
more-pi --provider openclaw-codex --model gpt-6-astra
more-pi --provider anthropic --model claude-opus-5
more-pi --provider ollama-cloud --model qwen3.5:397b-cloud
The OpenClaw Codex provider reads credentials from:
~/.openclaw/agents/main/agent/auth-profiles.json
Override the path with:
OPENCLAW_AUTH_PROFILES_PATH=/path/to/auth-profiles.json more-pi
GPT models
The extension's Codex aliases (gpt-5.6, gpt-6-astra) are listed under Pi's own
openai-codex provider as well as under openclaw-codex, so the full GPT lineup is
reachable through whichever credentials you have — a Pi openai-codex login works on
its own, no OpenClaw auth profile required.
more-pi --provider openai-codex --model gpt-6-astra
Anthropic
The extension re-registers the anthropic provider so the Claude 5 flagships are
selectable on the pinned Pi release. Pi 0.80.10's catalogue stops at Claude Opus 4.8,
so claude-opus-5 and claude-fable-5-1 ship with the extension; every model Pi
already knows is folded back in, and Pi's entry wins on an id collision. Drop the
fallbacks once the pinned Pi ships them.
Credentials
Resolved in this order:
- A credential stored by Pi —
/loginin Pi, or theanthropicentry in~/.pi/agent/auth.json. This includes Claude Pro/Max OAuth, which the re-registration leaves intact. ANTHROPIC_AUTH_TOKEN, if exported.ANTHROPIC_API_KEY.
more-pi --provider anthropic --model claude-opus-5
Ollama Cloud
Ollama Cloud connects directly to https://ollama.com/v1 (no local Ollama server required).
Setup
- Get an API key from ollama.com
- Configure via one of:
/loginin Pi → API key → Ollama Cloudexport OLLAMA_API_KEY="your-key"- Multiple keys with automatic rotation:
export OLLAMA_API_KEYS="key-one,key-two,key-three"
~/.pi/agent/auth.json(comma-separated keys also work in thekeyfield):
{
"ollama-cloud": {
"type": "api_key",
"key": "your-key"
}
}
- Refresh models (optional — baked-in list ships with the extension):
/ollama-cloud-refresh
All catalogued models are listed. Set OLLAMA_CLOUD_FILTER_LOCKED=1 to probe each
one at startup and hide those your subscription cannot reach.
Pi TUI
more-pi --provider ollama-cloud --model <model-id>
Use /model or Ctrl+L to pick any Ollama Cloud model under the ollama-cloud provider.
OpenAI-compatible endpoint
Start a universal OpenAI-compatible HTTP server that routes to Codex, Ollama Cloud, and Pi built-in providers (OpenRouter, Groq, DeepSeek, etc.):
# Core OpenAI-compatible mode
more-pi --mode endpoint --port 8888
# VS Code Copilot custom endpoint mode (optimized streaming)
more-pi --mode vscode --port 8888
# Ollama-compatible mode — auto model discovery in VS Code (recommended)
more-pi --ollama
--ollama listens on port 11434 by default (Ollama's default). Stop a local Ollama server first, or use --port 11435 and set VS Code's Ollama endpoint accordingly.
Requiring a key from clients
The server binds 0.0.0.0 and is open by default — anyone who can reach the port
can use it, and their Authorization: Bearer is treated as a bring-your-own upstream
key. Set MORE_PI_API_KEY to require a secret from every client instead:
MORE_PI_API_KEY=your-server-key more-pi --ollama
Add --codex-only to serve just the Codex models. Provider keys are read from the
environment and from Pi's stored credentials, so an unrelated OPENROUTER_API_KEY
exported in your shell would otherwise publish that provider's whole catalogue on a
publicly reachable endpoint:
MORE_PI_API_KEY=your-server-key more-pi --ollama --codex-only
Clients then send Authorization: Bearer your-server-key or X-Api-Key: your-server-key;
anything else gets 401. /health and / stay open for process supervisors. The gate
secret is consumed by more-pi and never forwarded upstream, so bring-your-own-key still
works for callers presenting a different token. Leaving MORE_PI_API_KEY unset keeps the
previous open behaviour.
Dependency compatibility
This version requires Node.js 22.19+ and uses Pi 0.80.10. Pi 0.80.8 removed the public AuthStorage export; more-pi now uses readStoredCredential for credential discovery and ModelRuntime for API-key/OAuth resolution. Existing auth.json credentials still work.
If an older more-pi installation reports does not provide an export named 'AuthStorage', upgrade to more-pi 0.1.22 or later:
npm install -g more-pi@latest
more-pi --ollama
To build and install from this checkout:
pnpm install --frozen-lockfile
pnpm run build
npm install -g .
more-pi --ollama
Pi dependencies are pinned and pnpm run build only compiles; dependency upgrades are explicit. Run pnpm run test:ollama after upgrading them. more-pi --version currently forwards to Pi, so it reports the Pi version rather than the more-pi package version.
Ollama mode endpoints (VS Code auto-discovery)
| Route | Method | Description |
|---|---|---|
/api/version |
GET | Ollama version check (VS Code requires ≥ 0.6.4) |
/api/tags |
GET | Native Ollama model list |
/api/show |
POST | Model capabilities (tools, vision, context length) |
/v1/chat/completions |
POST | OpenAI-compatible chat |
/v1/models |
GET | OpenAI-compatible model list |
/health |
GET | Health check |
Endpoints (core / vscode modes)
| Route | Method | Description |
|---|---|---|
/v1/chat/completions |
POST | Chat completions for any available model |
/v1/models |
GET | List all available models across providers |
/health |
GET | Health check |
API key detection
Provider credentials are resolved per backend:
| Provider | Env var | auth.json key |
|---|---|---|
| Anthropic | ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY |
anthropic |
| Ollama Cloud | OLLAMA_API_KEY or OLLAMA_API_KEYS |
ollama-cloud |
| OpenRouter | OPENROUTER_API_KEY or OPENROUTER_API_KEYS |
openrouter |
| OpenAI | OPENAI_API_KEY |
openai |
| Other Pi providers | See pi-ai env map | provider id |
All providers also accept Authorization: Bearer <key> from the client (used by VS Code).
Multi-key rotation (Ollama Cloud + OpenRouter)
When you configure multiple API keys, more-pi automatically rotates to the next key when one hits a rate limit. There is no usage API for these providers, so limits are tracked heuristically:
| Provider | Tracked windows | Default cooldown |
|---|---|---|
| Ollama Cloud | 5-hour session + weekly | 5 hours / 7 days |
| OpenRouter | Daily (UTC) | Until next UTC midnight |
export OLLAMA_API_KEYS="key1,key2,key3"
export OPENROUTER_API_KEYS="key1,key2"
more-pi --mode endpoint --port 8888
On HTTP 429 / rate-limit errors (before any response content is sent), the server marks that key as cooling down and retries with the next key. State is persisted in ~/.pi/agent/cache/api-key-pool.json across restarts.
Optional tuning:
export MORE_PI_OLLAMA_SESSION_WINDOW_MS=18000000 # 5 hours
export MORE_PI_OLLAMA_WEEKLY_WINDOW_MS=604800000 # 7 days
Ollama Cloud models appear in /v1/models when their credentials are configured, or when a Bearer token is sent with the request. The full catalogue is listed by default, and a model you are not entitled to fails at request time with the provider's own error.
To hide subscription-gated models instead, set OLLAMA_CLOUD_FILTER_LOCKED=1. Each model is then probed with a minimal API request on server start and the locked ones are dropped from the list. The probe costs one request per model, so listing stays instant while it is off.
VS Code setup (recommended: Ollama mode)
VS Code's built-in Ollama provider auto-discovers models via /api/tags and /api/show. Use --ollama instead of Custom Endpoint:
- Stop local Ollama if it is using port 11434 (or pick another port with
--port) - Configure provider keys (
OLLAMA_API_KEY,auth.json, etc.) - Run:
more-pi --ollama
- In VS Code: Chat: Manage Language Models → Add Models → Ollama
- Endpoint:
http://localhost:11434(or your host/port) - All configured models appear automatically — no
chatLanguageModels.jsonediting
pi-coding-agent setup (another Pi instance via Ollama endpoint)
When a second pi-coding-agent instance connects to more-pi --ollama, it must declare vision support in ~/.pi/agent/models.json. Pi defaults custom models to text-only (input: ["text"]), which causes the agent to reject images with "model does not support images" before the request reaches more-pi.
Generate a ready-to-use config (includes "input": ["text", "image"] for vision-capable models and "reasoning": true with thinkingLevelMap for thinking models):
more-pi --pi-models-config --host http://localhost:11434 > ~/.pi/agent/models.json
Without this, pi defaults custom models to text-only and non-reasoning, so images and thinking levels are rejected before requests reach more-pi.
Set provider keys (OPENCLAW_API_KEY, OLLAMA_API_KEY, auth.json, etc.) before generating so all backends appear. Re-run after adding providers.
VS Code setup (Custom Endpoint — manual model list)
VS Code's Custom Endpoint provider (vendor: "customendpoint") does not auto-fetch models from GET /v1/models. That is a VS Code limitation: each model must be listed manually in chatLanguageModels.json with toolCalling, vision, and token limits. more-pi already serves /v1/models, but VS Code ignores it for custom endpoints.
- Run
more-pi --mode vscode --port 8888 - Generate a VS Code config from your configured providers:
more-pi --vscode-config --host http://192.168.8.3:8888 > chatLanguageModels.json
Set OLLAMA_API_KEY (and other provider keys in auth.json or env) before running --vscode-config so Ollama Cloud and other backends appear in the output. Re-run after adding providers or refreshing models.
- Copy the generated JSON into VS Code's
chatLanguageModels.json(opened via Chat: Manage Language Models), setapiKeyif needed, and reload the window. - Pick a model from the model picker.
Important: Use per-model url values pointing at http://<host>:<port>/v1/chat/completions. Do not rely on a provider-level url alone — VS Code will not discover models from more-pi's /v1/models endpoint for customendpoint.
Models need "toolCalling": true to appear in the VS Code model picker.
Package behavior
- Does not patch
@earendil-works/pi-aior@earendil-works/pi-coding-agent. - Reuses pi's built-in
openai-codex-responsesandopenai-completionstransports. - Mirrors the installed pi-ai
openai-codexmodel list intoopenclaw-codexat extension load time. - Ships a baked-in Ollama Cloud model list; run
/ollama-cloud-refreshfor the latest catalog. The whole list is offered; setOLLAMA_CLOUD_FILTER_LOCKED=1to hide models your plan cannot reach. - Can also be installed as a pi package; its
pi.extensionsmanifest points atdist/extension.js.
Development
pnpm run build
pnpm publish