Use PQWERAI AI from VS Code¶
The Windows wallet runs a small OpenAI-compatible endpoint on your own PC (http://127.0.0.1:9440/v1). Editor
extensions and scripts that speak the OpenAI API (Continue, Cline, Roo Code, the OpenAI Python/JS SDKs, curl) send
their chat requests there, and the wallet forwards them to whoever you chose under AI Sharing → Use AI.
Experimental, test network
This feature is part of wallet 0.9.0 for chain 20778 (published 28 November 2026); paid answers need the AI market, which is deployed on 20778, and a registered provider (none independent on 20778 yet). tPQAI has no value. Author review only, not independently audited.
Why the wallet, and not Core or the explorer¶
- Core (the blockchain node) validates blocks. It holds no keys, so it cannot pay a provider, and it has no AI
methods (its only PQWERAI-specific RPC is
pqwerai_peerHealth). - The explorer is public and read-only. It already lists pools (
GET /api/v1/pools) but must never spend anyone's funds. - The wallet has your keys, knows the approved model, checks providers on chain and verifies every charge, so the AI
endpoint lives there. It listens on
127.0.0.1only.
Who answers: the route¶
| Route in the wallet | What happens | Cost |
|---|---|---|
| The model on this PC (default) | The request goes to the local GhostLLM runtime / llama-server endpoint of AI Sharing. Nothing leaves the PC. | Free |
| PQWERAI network: best provider | Any provider approved on chain (AIProviderRegistry.eligible) for the approved model; eligible first, then price, then latency. |
tPQAI per answer |
| A model pool | Only providers whose wallet is a ready or active member of the chosen pool (pool directory), still checked on chain. A pool with no serving member answers nothing. | tPQAI per answer |
| One provider | Exactly one provider address. | tPQAI per answer |
The same route is used by Ask the PQWERAI network on the AI Sharing page.
Paying without a prompt each time: the spending session¶
A paid answer is three wallet transactions on AIJobMarket (fund the escrow, authorize the exact request hash, accept the verified charge). An editor cannot show the wallet's password dialog, so you approve a spending session once:
- Budget (default 1 tPQAI), maximum per answer (default 0.1 tPQAI) and length (default 60 minutes, at most 24 hours).
- For each answer the wallet reserves the quoted maximum, funds it, sends the request, checks the provider's on-chain charge against the answer it actually received and accepts only a matching charge; only the real charge counts against the budget. A charge that does not match is not accepted (you can dispute it under AI escrow) and its whole reservation stays counted.
- The session ends at the budget, at the end time, when you press Stop, when you lock the wallet (including auto-lock), when you switch account or route, and when the wallet closes. The password is kept in memory only while the session runs.
The older 19 November measurement took about 60 seconds. Wallet 0.8.20/0.8.21 and the updated provider agent stream after the payer block: author-run 21 November checks saw first text 3.3–5.0 seconds after those transactions were mined. Inclusion time varies; see Paid Ask.
Set it up¶
- Wallet → AI Sharing → Use AI. Choose who answers.
- Click Start gateway. Copy the base URL and the API key (or click Copy Continue config).
- For a network, pool or provider route, click Start spending session and confirm with your password.
Continue¶
~/.continue/config.yaml:
models:
- name: PQWERAI
provider: openai
model: pqwerai
apiBase: http://127.0.0.1:9440/v1
apiKey: <API key from the wallet>
roles: [chat, edit, apply]
Cline and Roo Code¶
API provider OpenAI Compatible · Base URL http://127.0.0.1:9440/v1 · API key from the wallet · Model ID pqwerai.
Any OpenAI client¶
curl http://127.0.0.1:9440/v1/chat/completions \
-H "Authorization: Bearer $PQWERAI_AI_KEY" -H "Content-Type: application/json" \
-d '{"model":"pqwerai","messages":[{"role":"user","content":"Explain a Merkle tree in one sentence."}]}'
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:9440/v1", api_key="<API key from the wallet>")
print(client.chat.completions.create(model="pqwerai", messages=[{"role": "user", "content": "Hello"}]).choices[0].message.content)
API reference¶
| Method and path | Purpose |
|---|---|
GET /v1/models |
pqwerai (the route chosen in the wallet), pqwerai-local (always this PC's model, free), pqwerai-network (always the chosen network route, paid) |
POST /v1/chat/completions |
OpenAI chat request; stream: true returns server-sent events (one content chunk, because paid answers are verified before they are returned) |
GET /pqai/v1/status |
Route, pool/provider, and the spending session (budget, spent, remaining, expiry, requests), schema pqwerai-ai-gateway-status/1 |
- Any other model name is treated as
pqwerai, so editors that insist on their own model name still work. - Paid answers carry a
pqweraiobject:backend,model,provider,job,charge_wei. - Messages:
system,user,assistant(developercounts as system,toolresults become user text); text only; up to 200 messages and 400,000 characters;max_tokens1–4096 (default 512), further capped by the provider's quote (512 tokens on testnet today). - Errors use the OpenAI shape
{"error":{"message","type","code"}}: 401 without the right key, 403 for a browser request, 413 above 1 MiB, 503 when the route is not available (for example no spending session).
Security¶
- Loopback only (
127.0.0.1/localhost), never on the network. - Every request needs the API key (
Authorization: Bearer …); New key in the wallet revokes the old one. - Requests with a browser
Originheader or a foreignHostheader are refused, so web pages cannot use it. - The gateway holds no keys. Paid requests are signed only inside an active spending session, within its budget.
- The API key is stored in the wallet's
settings.json. It is not a wallet secret: by itself it cannot move funds, only spend within a spending session you started.
Limits¶
- Paid answers take about a minute (three transactions); streaming is not token by token.
- One paid request at a time; tool/function calling and images are not forwarded.
- The pool route needs pool members that are also approved providers; on 19 November 2026 the public pool
bonsai-2-communityhad no members yet. - Windows wallet only; the Linux CLI has no gateway yet.
Sources at 83ff5b69f0 (project repository, not public yet): apps/pqwerai-wallet-windows/README.md
Found a problem? Report a documentation issue · Build testnet-20778+83ff5b69f0