Install
Install with PiG
pig install npm:pig-requesty-providerPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
Pi manifest JSON
The pi field of package.json.
{
"extensions": [
"extensions/*"
]
}README
Written by the package's publisher, shown as published in version 0.1.0 (README.md). PiG does not review it.
🐷 pig-requesty-provider
Unlock hundreds of frontier & open-source LLMs in PiG with native tool calling, reasoning, real-time pricing, and built-in web search. 🐽
pig-requesty-provider bridges Requesty — the next-generation LLM router and AI gateway — directly into the PiG coding agent. Claude, GPT, Grok, Gemini, Kimi, Qwen, DeepSeek, GLM, and hundreds more under a single unified provider: requesty/<model>.
🐖 Go port of
pi-requesty-provider(TypeScript, Pi) into a native PiG extension. Same surface, same nose for models — but compiled by PiG into a runtime cell, with no Node runtime and nonode_modules.
⚡ Superpowers & Features
- 🌐 Native Web Search Integration — Browse the live web during agent execution without external tools. Toggle it with
/requesty search native on(powered by Requesty's server-side web grounding). - 🛡️ 100% Agent-Ready (Smart Tool Filtering) — Automatically filters out models lacking function/tool calling support. Everything you see in the picker works with PiG tools. Oink oink.
- 🧠 Deep Reasoning & Vision Support — Automatic detection of thinking budgets, reasoning effort, and multimodal vision capabilities (
["text", "image"]). - 💰 Real-Time Cost & Cache Tracking — Precise per-million-token cost mapping, including tiered pricing, cache read/write rates, and context limits.
- ⌨️ Extensible CLI & Multi-Level Autocomplete — Hierarchical
/requestycommand router with dynamic categorized help, nested tab-completion, and status monitoring. - 🔐 Native Auth & Multi-Region —
/requesty loginflow storing credentials in<agent-dir>/auth.json(mode0600), with US and EU endpoints.
🚀 Quick Installation
From npm
pig install npm:pig-requesty-provider
The package is not published to the registry yet: until then, install from GitHub or locally.
From GitHub
pig install git:github.com/xinaps-dev/pig-requesty-provider
Local Development
# Clone and enter
git clone https://github.com/xinaps-dev/pig-requesty-provider.git
cd pig-requesty-provider
# Install the Package root (not the extension directory)
pig install .
To uninstall, use the same source you installed from, e.g. pig remove npm:pig-requesty-provider.
Requirements: PiG 0.4.0 or later (pig version) and Go 1.27.1 to build from source (pig setup go). PiG compiles the extension into a runtime cell on first use and loads it from cache afterwards.
🎯 Getting Started
1. Authenticate
Inside a pig session:
/requesty login
- Paste your API key (get one at app.requesty.ai/api-keys).
- Pick your region:
- US (Global):
https://router.requesty.ai/v1(default) - EU (Frankfurt):
https://router.eu.requesty.ai/v1(GDPR compliant endpoint)
- US (Global):
2. Pick Any Model
Open the model selector:
/model
All models are listed as requesty/<model-id> (e.g. requesty/anthropic/claude-sonnet-4-5, requesty/openai/gpt-5). Type to filter.
Empty or stale list? The catalog is fetched when the extension loads and re-registered with:
/requesty sync
3. Enable Native Web Search (Optional)
Give your models real-time web access:
/requesty search native on
🛠️ Command Reference
/requesty ships with full autocomplete and categorized subcommands:
| Command | Category | Description |
|---|---|---|
/requesty | General | Show interactive help and the subcommand index |
/requesty login | Auth | Store the API key and region (US / EU) |
/requesty logout | Auth | Remove the stored credential (keeps other providers') |
/requesty sync | Provider | Fetch and refresh the catalog from the Requesty API |
/requesty status | Provider | Show credential, endpoint, model count, and search state |
/requesty search native on | Search | Enable Requesty's native web search grounding (persisted) |
/requesty search native off | Search | Disable native web search grounding |
/requesty search native status | Search | Show the switch and the model's capability |
⚙️ Environment Variables
Prefer configuring via environment? Simply export:
| Variable | Description | Default |
|---|---|---|
REQUESTY_API_KEY | Your Requesty API key | (required if not logged in) |
REQUESTY_BASE_URL | Custom gateway endpoint | https://router.requesty.ai/v1 |
Credential precedence: stored credential → REQUESTY_API_KEY. Endpoint precedence: stored credential → endpoint chosen at login → REQUESTY_BASE_URL → US default.
Files the extension owns
All inside PiG's agent dir (~/.pig/agent by default, or whatever PIG_CODING_AGENT_DIR sets):
| File | Contents |
|---|---|
auth.json | The requesty provider credential. Shared with PiG; other providers' entries are preserved. Written with mode 0600. |
pi-requesty.json | Native web search switch and the endpoint chosen at login. |
requesty-models.json | Catalog cache, used when the endpoint does not respond. |
🔍 Model Metadata Mapping
The provider translates Requesty's model catalog into native PiG capabilities:
| Requesty Attribute | PiG Capability | Impact |
|---|---|---|
supports_reasoning | reasoning: true, compat.supportsReasoningEffort | Enables thinking/reasoning blocks |
supports_vision | input: ["text", "image"] | Allows image and multimodal inputs |
supports_tools / supports_function_calling | Catalog filter | Guarantees full agent compatibility |
supports_web_search | Model capability flag | Controls native web search injection |
context_window & max_output_tokens | contextWindow, maxTokens | Optimizes context management and limits |
pricing[] / input_price / caching_price | cost.input, cost.output, cost.tiers | Accurate prompt and cache cost tracking |
🏗️ Architecture
┌────────────────────────────────────────────────────────────────────────┐
│ PiG CLI / TUI Runtime │
│ │
│ /requesty login /requesty [sync|status|search] /model requesty │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌───────────────────────────────────────────────────────────────┐ │
│ │ 🐷 pig-requesty-provider (Go) │ │
│ │ │ │
│ │ ┌──────────────┐ ┌─────────────────┐ ┌──────────────┐ │ │
│ │ │ Auth │ │ CommandRouter │ │ Catalog │ │ │
│ │ │(login/logout │ │ (dynamic help + │ │ (discovers & │ │ │
│ │ │ US/EU) │ │ autocomplete) │ │ transforms) │ │ │
│ │ └──────────────┘ └─────────────────┘ └──────────────┘ │ │
│ │ │ │ │
│ │ ┌────────────────┴────────────────┐ │ │
│ │ │ before_provider_request Hook │ │ │
│ │ │ (native web_search injection) │ │ │
│ │ └────────────────┬────────────────┘ │ │
│ └───────────────────────────────┼───────────────────────────────┘ │
│ The host owns streaming, tool calling and normalization │
└───────────────────────────────────┼────────────────────────────────────┘
▼
┌──────────────────────────────┐
│ Requesty Router Gateway │
│ https://router.requesty.ai │
├──────────────────────────────┤
│ GET /v1/models │
│ POST /v1/chat/completions │
└──────────────────────────────┘
▼
<agent-dir>/auth.json │ <agent-dir>/pi-requesty.json
│ <agent-dir>/requesty-models.json
The provider registers by configuration (RegisterProvider with api: "openai-completions" and no streaming callback): PiG owns streaming, tool calling, and event normalization. The extension contributes authentication, catalog discovery, the /requesty surface, and web_search injection. The native-provider path would force reimplementing in Go the HTTP+SSE client the host already implements (the Go SDK ships no OpenAI-completions client), so it was discarded.
💻 Development & Contributing
Prerequisites
- Go 1.27.1 and PiG 0.4.0+.
Commands
cd extensions/pig-requesty-provider
go vet ./... && go test -race ./... # unit tests
cd ../.. && pig package validate . --json # Package manifest: 1 extension
./scripts/verify.sh # end-to-end against the local stub
pig install ./extensions/pig-requesty-provider --validate-only --json
pig -e ./extensions/pig-requesty-provider # real session; /reload after each edit
scripts/verify.sh first checks the Package manifest, then boots a local OpenAI-compatible server (testdata/stub) and asserts on what PiG actually put on the wire: catalog, filtering, command surface, switch persistence, web_search injection, and streaming. It uses a throwaway agent dir, so it never touches the real configuration.
Extension commands can be probed without the TUI:
pig -e . -p "/requesty status".ctx.Notifynotifications only render in the TUI, so in print mode verification is by observable effect (files written, no model call) and by unit tests of the text.
pig install <root> --validate-only does not work for this Package: PiG 0.4.0 resolves the Package root as if it were a Node extension and fails. Validate the manifest with pig package validate and the Go member with pig install ./extensions/pig-requesty-provider --validate-only.
Project Layout
pig-requesty-provider/
├── package.json # npm Package manifest (pig-package keyword)
├── extensions/
│ └── pig-requesty-provider/ # the Go extension: its own module + go.mod
│ ├── extension.go # factory and provider registration
│ ├── provider.go # catalog discovery
│ ├── client.go # Requesty REST client
│ ├── models.go # model and cost transformer
│ ├── credentials.go # auth and credential precedence
│ ├── commands.go # sync, status, login, logout subcommands
│ ├── search.go # switch and web_search injection
│ ├── router.go # hierarchical /requesty router
│ └── *_test.go # unit tests (+ golden fixture)
├── testdata/
│ ├── catalog-golden.json # fixture: 10 real GET /v1/models records
│ └── stub/ # OpenAI-compatible verification server
├── scripts/
│ └── verify.sh # end-to-end verification
└── .github/workflows/ci.yml # formatting, vet, tests, manifest, E2E
Three PiG rules shape this layout:
- A Go member is only discovered when its own directory is a module root (
go.modinsideextensions/pig-requesty-provider/). - The Package root must not double as an extension root: with no
go.modat the root, the root is just an npm manifest. - The directory name fixes the extension identity (
register:name_mismatchotherwise):pig-requesty-provider, same as the npm package. 🐷
📦 Publishing
npm publish
The tarball carries source only (extensions/, README, LICENSE, CHANGELOG): PiG compiles the extension from that source, so there are no binaries to distribute. The pig-package keyword prepares the listing in the pi-in-go.dev catalog, which does not exist yet in PiG 0.4.0.
🐷 Divergences from the Pi plugin
| Aspect | Pi (pi-requesty-provider) | PiG (pig-requesty-provider) |
|---|---|---|
| Language | TypeScript | Go (own module) |
| Config root | ~/.pi | ~/.pig |
| Own settings | ~/.pi/agent/pi-requesty.json | <agent-dir>/pi-requesty.json |
| Login | /login requesty (masked key) | /requesty login (the Go SDK exposes no secret input: plain text) |
| Runtime | Node | PiG-compiled runtime cell, no Node |
📄 License
MIT © xinaps
Made with 🐷 for PiG, from pi-requesty-provider.