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.20- Published
- Jul 9, 2026
- Downloads
- 1,372/mo · 289/wk
- Author
- guocity
- License
- MIT
- Types
- extension
- Size
- 209.7 KB
- Dependencies
- 5 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, Gemini CLI, and Ollama Cloud providers.
Usage
more-pi --provider openclaw-codex --model gpt-5.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
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
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, Gemini CLI, 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.
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 |
|---|---|---|
| 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. On server start, each Ollama Cloud model is probed with a minimal API request; models that return a subscription-required error are hidden from the model list.
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. - Can also be installed as a pi package; its
pi.extensionsmanifest points atdist/extension.js.
Development
pnpm run build
pnpm publish