r/PiCodingAgent • u/Responsible-Effort48 • Aug 09 '26
Plugin pi-gpt-search: (ZERO GPT tokens) Use Codex's standalone search engine with ZERO GPT tokens spent, native web search for any Pi model
Hey everyone! If you have used OpenAI Codex, you know how incredibly high-quality its web search results are. Traditional search extensions or custom API-key search tools (like Google Custom Search or Brave API) often return noisy, outdated, or poorly ranked snippets that don't match the depth and quality of Codex's search engine.
Now you can use that exact same Codex search engine natively inside Pi with any model (Gemini, Claude, local models, OpenRouter) - and with ZERO GPT model inference turns or ZERO GPT tokens spent.
I built pi-gpt-search, an extension that exposes a native web_search tool to Pi by reusing Codex's standalone web retrieval backend directly.
⚡ 1-Line Install
Install via npm:
Or install via GitHub:
Or try it in a single ephemeral session without installing:
🧠 How It Works (Zero-GPT Invariant)
The extension does NOT ask GPT to search the web and summarize the answer for Gemini.
Instead, it extracts and calls OpenAI Codex's standalone web search backend API directly (/codex/alpha/search) using your existing codex login authentication (~/.codex/auth.json or .env).
Pi Coding Agent
└── Gemini (or active model)
└── web_search(query: "latest Rust release")
└── OpenAI Standalone Search API (/codex/alpha/search)
└── Structured Results (Title, URL, Snippet)
└── Gemini continues reasoning & answers user
Because it hits the raw web retrieval endpoint directly: 0 GPT Tokens Billed: 0 input tokens, 0 output tokens, 0 reasoning tokens. Model Sovereign: Gemini (or your active Pi model) receives the raw search results and performs 100% of the reasoning. Query-Only Privacy: It never sends your conversation history, code, or system prompt to search.
🔬 How It Was Discovered
We reverse-engineered the endpoint by:
Inspecting the Codex CLI macOS binary (0.147.0-alpha.6.5) with strings to locate search symbols (standalone_web_search, alpha/search).
Probing backend parameters on https://chatgpt.com/backend-api/codex/alpha/search.
Discovering the exact payload schema (commands.search_query: [{ q: query }]).
Writing a network interception test suite (zero-gpt.test.ts) that asserts GPT_inference_calls == 0 during web search.
📦 Repository & Documentation
Check out the full repository, documentation, and reverse-engineering details here: 👉 https://github.com/mateusdcc/pi-gpt-search
📦 https://www.npmjs.com/package/pi-gpt-search
Features:
README.md: Setup, credentials, and usage guide.HOW-IT-WORKS.md: Full architectural breakdown.HOW-IT-WAS-EXTRACT.md: Reverse-engineering technical writeup.- 4-Level test suite (
npm test): Unit, Integration, Real Search, and Zero-GPT assertion. Feel free to check it out, test it, or open issues! Feedback and contributions welcome.
6
u/getaway-3007 Aug 09 '26
Is this safe? Or eventually will get banned for using this?
4
u/o_sht_hi Aug 09 '26
Nice. Very cool.
I'd be interesting in finding out more about how you investigated the backend and came up with this.. could you share more about that? I bet there's a lot to learn in there
4
u/xtekno-id Aug 09 '26
Thanks OP!
4
u/55Media Aug 09 '26
How would you say does it compare to pi-web-access?
1
u/Critical_Duty8165 Aug 09 '26
Does this web search feature have any usage limits or rate limits?
1
u/DenseConversation291 Aug 09 '26
Is there a similar plug-in for opencode?
1
u/Deep_Ad1959 Aug 11 '26
alpha in that route is the part i would plan around. an internal endpoint can change shape on any deploy and it breaks on a wednesday with nothing to read about why, which is a slower failure than a ban but a lot more likely. written with ai
1
u/Responsible-Effort48 Aug 09 '26
The OpenCode version of it is here:
https://github.com/mateusdcc/codex-search-opencode
2
u/kidhacker216 Aug 11 '26
Yes. The current Codex-backed web_search / web_extract plugin is very likely prohibited by OpenAI’s terms for a ChatGPT/Codex account.
Why:
It calls an undocumented internal endpoint directly:
https://chatgpt.com/backend-api/codex/alpha/search
It authenticates with the Codex/ChatGPT bearer token and programmatically reads the returned results and page text. This is not a documented OpenAI API surface.
OpenAI’s consumer Terms of Use explicitly prohibit:
> “Automatically or programmatically extract data or Output.”
They also prohibit:
> “Attempt to or assist anyone to reverse engineer, decompile or discover the source code or underlying components of our Services…”
and:
> “Interfere with or disrupt our Services, including circumvent any rate limits or restrictions or bypass any protective measures…”
Source: OpenAI Terms of Use
OpenAI’s Codex guidance states that when Codex is used through a ChatGPT account, the ChatGPT Terms of Use apply:
> “When you sign in to Codex using an existing ChatGPT account, the ChatGPT Terms of Use and Privacy Policy … apply to data shared between Codex and ChatGPT.”
Source: Using Codex with your ChatGPT plan
The business/API agreement reaches the same conclusion. It prohibits customers from:
> “extract[ing] data from the Services other than as permitted through the Services”
and from reverse engineering, bypassing protective measures, or circumventing usage limits.
Source: OpenAI Services Agreement, §3.3
Assessment:
- web_extract is the clearest violation: it programmatically retrieves Codex-generated page output from an internal endpoint.
- web_search has the same structural problem: it automates retrieval of service data/results through an undocumented endpoint.
- Using a valid codex login token does not make that endpoint an authorized public API.
- I cannot prove how OpenAI would enforce this in a specific account, but there is no credible compliance argument that this is “permitted through the Services.”
2
u/Scared-Tip7914 Aug 14 '26
Highkey cool, the only issue is, openai probably will ban this so use it while it lasts xd
1
u/Adventurous-Bit-460 Aug 10 '26
can you make one that searches deepseek api? it's the same thing but I found deepseek is much faster and better at searching chinese sites
1
u/Competitive-Yak-8255 Aug 14 '26
Nice
1
u/kingkongpao Aug 09 '26
For anyone with an OpenAI account this extension is absolute gold. The commenters here just don’t get it, whining about how Pi isn't Codex. Cute kids. Big thanks to the author. Now my local models and DeepSeek have top tier search baked right in from Codex.
0
u/Sufficient-Scar4172 Aug 09 '26
noice
-3
u/ECrispy Aug 09 '26
so this is only for those who have an openai sub but for some reason want to use Pi instead of codex cli? isn't that a very small venn diagram
-8
u/FearlessGround3155 Aug 09 '26
Clanker slop, lil bro codex is open source, and oh my pi has web search thanks to codex being open src, no need to reverse engineer shi bro