{"id":50507626,"url":"https://github.com/xcodebuild/pi-gpt-cache","last_synced_at":"2026-06-02T17:30:59.739Z","repository":{"id":357261073,"uuid":"1236155946","full_name":"xcodebuild/pi-gpt-cache","owner":"xcodebuild","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-12T02:08:02.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-12T04:14:50.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xcodebuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-12T02:05:13.000Z","updated_at":"2026-05-12T02:08:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xcodebuild/pi-gpt-cache","commit_stats":null,"previous_names":["xcodebuild/pi-gpt-cache"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/xcodebuild/pi-gpt-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcodebuild%2Fpi-gpt-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcodebuild%2Fpi-gpt-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcodebuild%2Fpi-gpt-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcodebuild%2Fpi-gpt-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xcodebuild","download_url":"https://codeload.github.com/xcodebuild/pi-gpt-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcodebuild%2Fpi-gpt-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33833277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-02T17:30:58.826Z","updated_at":"2026-06-02T17:30:59.734Z","avatar_url":"https://github.com/xcodebuild.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pi-gpt-cache\n\nA [Pi](https://pi.dev/) package that improves OpenAI Responses API prompt caching by adding `prompt_cache_key` to OpenAI provider requests.\n\n## What it does\n\nThis package registers a Pi extension that overrides the existing `openai` provider's `openai-responses` streaming implementation. It keeps Pi's built-in OpenAI models, delegates request handling to Pi's built-in `streamSimpleOpenAIResponses`, and injects `prompt_cache_key` into the final Responses API payload.\n\nThe cache key is Pi's `options.sessionId`, matching the Codex client's default behavior of deriving `promptCacheKey` from the session ID. Requests from the same Pi session can share OpenAI prompt-cache affinity. If another hook already sets `prompt_cache_key`, this extension leaves that value unchanged.\n\n## Installation\n\nInstall as a Pi package:\n\n```sh\npi install npm:pi-gpt-cache\n```\n\nFor a project-local install:\n\n```sh\npi install -l npm:pi-gpt-cache\n```\n\nTo test directly from a checkout before publishing:\n\n```sh\npi -e ./extensions/openai-responses-prompt-cache.ts\n# or\npi install ./path/to/pi-gpt-cache\n```\n\n## Configuration\n\nNo configuration is required. The prompt cache key always comes from the Pi session id.\n\n## Repository layout\n\n- `extensions/openai-responses-prompt-cache.ts` - Pi extension entrypoint included in the published npm package.\n\n## How it works\n\nThe extension calls:\n\n```ts\npi.registerProvider(\"openai\", {\n  api: \"openai-responses\",\n  streamSimple(...) {\n    // delegates to streamSimpleOpenAIResponses(...)\n    // and adds prompt_cache_key to the payload\n  },\n});\n```\n\nBecause the provider override does not define `models`, Pi preserves its existing OpenAI model list and only replaces the streaming implementation.\n\n## Development\n\nPreview the npm package contents:\n\n```sh\nnpm run pack:dry-run\n```\n\nPublish when ready:\n\n```sh\nnpm publish\n```\n\nMake sure the package name in `package.json` is available on npm, or rename it before publishing.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcodebuild%2Fpi-gpt-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxcodebuild%2Fpi-gpt-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcodebuild%2Fpi-gpt-cache/lists"}