{"slug": "i-reverse-engineered-codex-s-web-search-for-use-with-claude-and-any-local-model", "title": "I reverse-engineered Codex's web search for use with Claude, and any local model", "summary": "Developer Mateus DCC released pi-gpt-search, an open-source npm package that gives any Pi model (Gemini, Claude, local models, OpenRouter) real-time web search by reusing OpenAI Codex's standalone search endpoint with zero GPT tokens consumed. The tool, installable via npm or GitHub, supports slash commands and LLM tools, reuses existing Codex credentials, and preserves data privacy by sending only queries.", "body_md": "Native, Model-Independent Web Search for Pi using OpenAI Codex Standalone Search Engine.\n\n`pi-gpt-search`\n\ngives **any** Pi model (Gemini, Claude, local models, OpenRouter) real-time web search capabilities by reusing OpenAI Codex's standalone web retrieval infrastructure - with **ZERO GPT Model Inference Turns** and **ZERO GPT Tokens Consumed**.\n\nInstall via npm:\n\n```\npi install npm:pi-gpt-search\n```\n\nOr install via GitHub:\n\n```\npi install https://github.com/mateusdcc/pi-gpt-search\n```\n\nOr install project-locally for your current repository (`-l`\n\nflag):\n\n```\npi install npm:pi-gpt-search -l\n```\n\nOr try it temporarily in a single session without installing:\n\n```\npi -e npm:pi-gpt-search\n```\n\n- 🚀\n**Zero GPT Tokens Spent:** Pure web retrieval via OpenAI's backend endpoint. No GPT/Codex LLM turns are executed, meaning**0 input tokens, 0 output tokens, and 0 reasoning credits are billed**. - 👑\n**Model Sovereign:** Your active Pi model (e.g., Gemini 3.5 Flash / Gemini 3.1 Pro) remains the sole reasoning model. - 🛠️\n**Slash Command & LLM Tools:** Works both automatically as LLM tools (`codex-search`\n\n&`codex-research`\n\n) and as a direct user command (`/gpt-search`\n\n). - 🔑\n**Credential Reuse:** Automatically uses your existing`codex login`\n\nsession (`~/.codex/auth.json`\n\n) or custom`.env`\n\ntokens. - 🛡️\n**Data Privacy:** Query-only by default. Does not send conversation history, project files, or system prompts to search.\n\n```\nPi Coding Agent\n └── Gemini (or active model)\n      ├── codex-search(query: \"latest Rust release\")\n      │    └── Codex/OpenAI Standalone Search API (/codex/alpha/search)\n      │         └── Structured Results (Title, URL, Snippet)\n      │              └── Gemini continues reasoning & answers user\n      │\n      └── codex-research(search_query: [...], open: [...], find: [...])\n           └── Multi-Step Web Research Harness\n                └── Deep document content, pattern matching & citations\n```\n\nRun either Codex tool yourself without spending LLM tokens:\n\n```\n/codex-search Rust 1.97 release notes\n/codex-research OpenAI Codex GitHub repository\n```\n\nUse `codex-search`\n\nfor a quick lookup and `codex-research`\n\nwhen you want more comprehensive results. The direct commands preserve their tool defaults: `short`\n\nfor `codex-search`\n\nand `long`\n\nfor `codex-research`\n\n.\n\n`/gpt-search <query>`\n\nremains available as a simple legacy alias.\n\nAsk any model a question requiring current facts (single-query lookup):\n\n```\npi --model antigravity/gemini-3.5-flash \"What is the latest release of Rust and what changed?\"\n```\n\nThe model uses it automatically for quick lookups that need current information.\n\n```\n[PI_WEB_SEARCH_DEBUG] req_id=maqk8a5 query=\"latest Rust release version and date 2026\" provider=codex\n[PI_WEB_SEARCH_DEBUG] req_id=maqk8a5 status=200 elapsed_ms=1863 results=41\n```\n\nAsk models to conduct deep, iterative web research with multi-query execution, page content inspection, pattern finding, and link navigation. The model manages the research steps and sources for you.\n\nThe pre-rename tool name `web`\n\nis kept as a backward-compatible alias. It delegates to the same implementation as `codex-research`\n\nand prepends a deprecation notice on every invocation. New integrations should use `codex-research`\n\ndirectly.\n\n**Pi Coding Agent:**`pi`\n\nCLI installed (`v0.80+`\n\n).**Node.js:**`v18.0.0`\n\nor higher.**OpenAI Codex Auth:** An authenticated Codex session (run`codex login`\n\nin terminal, or set`CODEX_ACCESS_TOKEN`\n\nin`.env`\n\n).\n\nIf you prefer manual placement instead of `pi install`\n\n:\n\n```\n# Global (All projects)\nmkdir -p ~/.pi/agent/extensions\ncp -r pi-gpt-search ~/.pi/agent/extensions/\n\n# Project-local\nmkdir -p .pi/extensions\ncp -r pi-gpt-search .pi/extensions/\n```\n\nCopy `.env.example`\n\nto `.env`\n\nif you want to explicitly override your Codex access token:\n\n```\ncp .env.example .env\n```\n\nEdit `.env`\n\n:\n\n```\n# Optional: If unset, automatically reads ~/.codex/auth.json\nCODEX_ACCESS_TOKEN=your_token_here\nCODEX_ACCOUNT_ID=your_account_id_here\n\n# Enable debug logging\nPI_WEB_SEARCH_DEBUG=1\n```\n\nSecurity Note:Never commit`.env`\n\nto Git.`.env`\n\nis listed in`.gitignore`\n\n.\n\n`pi-gpt-search`\n\ncomes with a 4-level test suite:\n\n```\nnpm test\n```\n\nTest suite breakdown:\n\n**Unit Tests (** Schema validation, DTO normalization, error classes, output formatting, collapsible display.`unit.test.ts`\n\n,`commands.test.ts`\n\n,`normalize.test.ts`\n\n,`output.test.ts`\n\n,`web-tool.test.ts`\n\n):**Integration Tests (** Mock server handling for 200, 401, 403, 429, 500, timeouts, cancellation.`provider-integration.test.ts`\n\n):**Real Search Test (** Live execution against OpenAI's search endpoint and session continuity.`real-search.test.ts`\n\n&`real-endpoint.test.ts`\n\n):**Zero-GPT Verification (** Network interception test proving`zero-gpt.test.ts`\n\n):**0 GPT inference calls** are made.**E2E Research Harness Suite (** Full end-to-end multi-step web research test suite.`e2e-research.test.ts`\n\n):\n\n[HOW-IT-WORKS.md](/mateusdcc/pi-gpt-search/blob/main/HOW-IT-WORKS.md)- Deep architectural breakdown of modules, data flow, TUI renderers, context isolation, and cancellation.[HOW-IT-WAS-EXTRACT.md](/mateusdcc/pi-gpt-search/blob/main/HOW-IT-WAS-EXTRACT.md)- Reverse-engineering guide documenting how the standalone search endpoint was discovered.\n\n**Search Index Scope:** Returns search result snippets, URLs, and document views; does not include a full headless browser DOM renderer.**Session Auth:** Requires an active ChatGPT/Codex login session (`codex login`\n\n). Expired sessions require running`codex login`\n\nto re-authenticate.\n\nMIT License.", "url": "https://wpnews.pro/news/i-reverse-engineered-codex-s-web-search-for-use-with-claude-and-any-local-model", "canonical_source": "https://github.com/mateusdcc/pi-gpt-search", "published_at": "2026-08-11 10:17:01+00:00", "updated_at": "2026-08-11 10:41:38.138864+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "artificial-intelligence"], "entities": ["Mateus DCC", "OpenAI", "Codex", "Pi", "Gemini", "Claude", "OpenRouter", "pi-gpt-search"], "alternates": {"html": "https://wpnews.pro/news/i-reverse-engineered-codex-s-web-search-for-use-with-claude-and-any-local-model", "markdown": "https://wpnews.pro/news/i-reverse-engineered-codex-s-web-search-for-use-with-claude-and-any-local-model.md", "text": "https://wpnews.pro/news/i-reverse-engineered-codex-s-web-search-for-use-with-claude-and-any-local-model.txt", "jsonld": "https://wpnews.pro/news/i-reverse-engineered-codex-s-web-search-for-use-with-claude-and-any-local-model.jsonld"}}