pi-provider-ampersand-bridge
v0.1.1
Published
Unofficial ai& (api.aiand.com) model provider for Pi with live model discovery
Downloads
464
Maintainers
Readme
pi-provider-ampersand-bridge
An unofficial Pi provider for the
ai& OpenAI-compatible API at api.aiand.com. Not affiliated with or endorsed by ai&; it just talks to the public service with your own API key.
Features
- Discovers every model available to your key from ai&'s authenticated
GET /v1/modelsendpoint - Ships the current ai& catalog as an offline fallback (DeepSeek, GLM, Kimi, Qwen, Gemma, GPT OSS, Motif)
- Uses live context, output, modality, reasoning-effort, and pricing metadata when ai& returns it
- Supports Pi's thinking selector through the standard OpenAI
reasoning_effortrequest field - Uses Pi's built-in OpenAI Chat Completions transport—no custom protocol or runtime dependency
Install
pi install npm:pi-provider-ampersand-bridgeTo try a local checkout:
pi -e ./src/index.tsAuthenticate
Create a key in the ai& console and export it before starting Pi:
export AMPERSAND_API_KEY="your-key"
piYou can instead store an API-key credential for the ampersand provider in Pi's auth.json, or override the provider in models.json.
Select a model with /model. Refresh the remote catalog with Pi's normal model refresh flow (pi update --models). If discovery is temporarily unavailable, the extension retains the last successful catalog, or the bundled fallback on first use. As with every authenticated Pi provider, models become selectable after a key is configured.
Thinking effort
Use Pi's thinking-level control as usual. Each model advertises its own accepted efforts from the live catalog, and Pi never sends a level the model refuses:
deepseek-ai/*,zai-org/glm-5.2,google/gemma-4-31b-it,motif-technologies/motif-3,qwen/qwen3.6-27bexposeoff,high, and (where listed)maxzai-org/glm-5.3*andmoonshotai/kimi-k3are always-on reasoners withlow,high, andmaxqwen/qwen3.8-27bruns up toxhigh;openai/gpt-oss-120bcaps athighmoonshotai/kimi-k2.7-codealways reasons athigh
Models that do not accept medium natively map Pi's default medium level to the catalog's reasoning_effort_default (for example Kimi K3 defaults to max, Gemma 4 to none), so a fresh session starts at the effort ai& nominates.
Model metadata
The fallback catalog mirrors the live GET /v1/models response (USD per million tokens):
| Model | Context | Max output | Input | Reasoning efforts |
| --- | ---: | ---: | --- | --- |
| deepseek-ai/deepseek-v4.1-flash | 1,048,576 | 384,000 | text, image | none, high, max |
| zai-org/glm-5.3 | 1,048,576 | 131,072 | text | low, high, max |
| zai-org/glm-5.3-flash | 1,048,550 | 131,072 | text, image | low, high, max |
| qwen/qwen3.8-27b | 262,144 | 32,768 | text, image | none, low, medium, xhigh |
| moonshotai/kimi-k3 | 1,048,576 | 131,072 | text, image | low, high, max |
| zai-org/glm-5.2 | 1,048,576 | 131,072 | text | none, high, max |
| google/gemma-4-31b-it | 262,144 | 32,768 | text, image | none, high |
| moonshotai/kimi-k2.7-code | 262,144 | 262,144 | text, image | high |
| motif-technologies/motif-3 | 262,144 | 262,144 | text | none, high |
| deepseek-ai/deepseek-v4-flash | 1,048,576 | 384,000 | text | none, high, max |
| qwen/qwen3.6-27b | 262,144 | 65,536 | text, image | none, high |
| deepseek-ai/deepseek-v4-pro | 1,048,576 | 384,000 | text | none, high, max |
| openai/gpt-oss-120b | 131,072 | 32,768 | text | low, medium, high |
An authenticated /models response replaces this list, so newly released or account-specific models appear without an extension release.
Account balance
Run /ampersand-balance in a session to fetch GET /billing/balance for your configured key. The command reports remaining credits (USD or JPY) or, for pay-as-you-go accounts, the number of requests remaining in today's allowance.
Catalog hardening
The live discovery pipeline mirrors the companion VS Code bridge so both projects see the same catalog:
- Default reasoning effort: the catalog's
reasoning_effort_default(or the bundled per-model default) steers Pi's defaultmediumthinking level whenever a model does not acceptmediumnatively, so a fresh session lands on the effort ai& nominates. - Chat models only: listings for embedders, rerankers, and image/audio/video models are filtered out, and model ids are canonicalized (trimmed, lowercased) before matching the bundled catalog.
- Field aliases:
context_length/max_context_tokens/max_model_lenare accepted alongsidecontext_window,max_completion_tokensalongsidemax_output_tokens, and pricing is read from a nestedpricingobject (prompt/completion/cache_prompt) or the flat per-million strings. Image input falls back toarchitecture.input_modalitiesandvision-style names when no modality data is present. - Transient-failure retry:
/modelsand/billing/balancerequests retry 429/502/503/504 responses and transient network errors up to three attempts with capped exponential backoff, honoringRetry-After(≤5s).
Development
npm install
npm run check
npm run packageProject
License
MIT
