mirror of
https://github.com/Misterio77/Foundry.git
synced 2026-08-24 10:04:09 -05:00
Bridges LibreChat's native Responses API custom endpoint to the ChatGPT Codex backend at chatgpt.com/backend-api/codex/responses. It exchanges a refresh token (CODEX_REFRESH_TOKEN) for access tokens on demand, derives the chatgpt-account-id from the id_token claims, injects the headers the backend gates on (originator, OpenAI-Beta, session), and reshapes the body (store:false, streaming, inline reasoning). Nothing is persisted to disk. Serves GET /v1/models, POST /v1/responses (streaming passthrough, or reassembled into a single response object for non-streaming callers), and GET /health. Ships a services.codex-openai-proxy NixOS module (host, port, environmentFile). The ChatGPT account only accepts a subset of model ids (gpt-5.5, gpt-5.4, gpt-5.4-mini); others such as gpt-5, the -codex variants, and gpt-5.5-mini 400. Probe with /v1/responses if OpenAI rotates the allowed set. Assisted-by: pi (claude-opus-4-8)