Spaces:
Paused
Paused
Commit History
-
fix: handle new Responses SSE lifecycle events (#137)
icebear +1: icebear0828Unverified signature* fix: handle new Responses SSE lifecycle events (output_item.added message, content_part) Upstream Codex API now wraps text responses in message/content_part lifecycle events. Our parser only recognized output_item.added with item.type=function_call, causing unknown event log spam. - Widen output_item.added to accept any item.type (message, etc.) - Add content_part.added and content_part.done as recognized no-op events - Update extractor to handle optional call_id/name on non-function_call items * chore: remove loose index signature from CodexOutputItemAddedEvent.item --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>1531084
-
fix: disable desktop context injection by default (#95) (#97)
icebear +1: icebear0828Unverified signature* fix: disable desktop context injection by default (#95) The proxy was injecting a ~1500 token desktop context system prompt into every request, inflating prompt_tokens from ~17 to ~1587 for a simple message. Add `model.inject_desktop_context` config option (default false) to skip injection unless explicitly enabled. * docs: update CHANGELOG for #95 * chore: revert unrelated default.yaml changes --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com>921d606
-
feat: tuple schema (prefixItems) support for structured outputs (#77)
icebear +1: icebear0828Unverified signature* feat: tuple schema support — prefixItems auto-conversion for structured outputs Upstream Codex API doesn't support JSON Schema prefixItems (tuple), so we convert tuple schemas to equivalent object schemas on the request side and reconvert the response back to arrays. All three endpoints (OpenAI, Gemini, Responses passthrough) are covered. - New module: src/translation/tuple-schema.ts (convert/reconvert/detect) - prepareSchema() composes tuple conversion + additionalProperties injection - Streaming: buffer text deltas when tupleSchema present, flush reconverted on completion - 23 unit tests for core conversion logic * fix: responses endpoint tuple reconversion + cleanup - Add tuple schema reconversion to /v1/responses (stream + collect), making all three endpoints consistent - Remove unrelated web/src/hooks/use-status.ts from this branch - Add console.warn to silent catch blocks for easier debugging - Add streaming buffer tradeoff comment --------- Co-authored-by: icebear0828 …e25a730
-
feat: display secondary rate limit window (weekly cap) in dashboard
icebear0828 +1: Claude Opus 4.6Add secondary_rate_limit to CodexQuota type and map secondary_window from Codex usage API. Dashboard now shows both primary (hourly) and secondary (weekly) quota bars with independent progress and reset times. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2996fd8
-
fix: review improvements — schema walker, status helper, UI i18n, CI version skip
icebear0828 +1: Claude Opus 4.61. walkSchema: add patternProperties, if/then/else traversal + cycle detection 2. proxy-handler: extract toErrorStatus() helper, centralize 4x StatusCode casts 3. Header StableText: dynamic t() references for i18n + whitespace-nowrap on status button 4. sync-electron.yml: cancel-in-progress: false + merge two pushes into one Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>6220911 -
fix: recursive additionalProperties injection + upstream error status propagation
icebear0828 +1: Claude Opus 4.61. Add injectAdditionalProperties() to recursively inject `additionalProperties: false` on every object-type node in JSON schemas. Codex API requires this explicitly but OpenAI's native API auto-injects it — our proxy was passing schemas verbatim causing 400s. 2. Fix CONNECT tunnel header parsing in curl-cli-transport: loop to skip intermediate header blocks (CONNECT 200, 100 Continue) before parsing the actual response headers. 3. Extract upstream HTTP status from error messages in non-streaming collect path instead of hardcoding 502. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4779e44
-
feat: add Structured Outputs support (response_format → text.format)
icebear0828 +1: Claude Opus 4.6OpenAI response_format (json_object/json_schema) and Gemini responseMimeType/responseSchema now translate to Codex text.format. /v1/responses endpoint passes through text field as-is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>53d3b3b -
fix: pass through cached_tokens from Codex API (#58)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* fix: pass through cached_tokens and reasoning_tokens from Codex API (#55) The proxy was only extracting input_tokens/output_tokens from Codex response usage, dropping input_tokens_details.cached_tokens and output_tokens_details.reasoning_tokens. This caused cached token counts to always show as 0 for downstream clients. Fixed across all three output formats (OpenAI, Anthropic, Gemini) in both streaming and non-streaming modes. Closes #55 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: pass reasoning_tokens through onUsage in Anthropic/Gemini translators The Anthropic and Gemini streaming translators were not forwarding reasoning_tokens via onUsage, unlike the OpenAI translator. Also fixes Gemini non-streaming path leaking cached_tokens: undefined by using conditional spread consistent with other translators. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com> Co-authored-by: Claud…fadda70
-
feat: /v1/responses passthrough endpoint + missing SSE event types + Docker docs fix (#37, #38)
icebear0828 +1: Claude Opus 4.6- Add /v1/responses endpoint for raw Codex Responses API passthrough with multi-account load balancing, no format translation - Recognize response.output_item.done, response.incomplete, response.queued SSE events to eliminate "Unknown event" debug log noise - Add cp .env.example .env step to Docker quick start in README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8068f1c
-
feat: model name suffix system + service_tier + Docker persistence fix (#35)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* feat: model name suffix system + service_tier (fast mode) support Add a unified model name suffix convention so CLI tools (Claude Code, opencode, etc.) can control reasoning effort and speed mode purely through the model name — no extra API fields needed. Suffix parsing (`parseModelName`): - `-fast` / `-flex` → `service_tier` - `-minimal` / `-low` / `-medium` / `-high` / `-xhigh` → `reasoning_effort` - Known model IDs and aliases are never suffix-parsed - Priority: explicit API field > suffix > model default > config default Backend: - `parseModelName()` in model-store.ts (core suffix resolver) - `service_tier` field in Zod schema + CodexResponsesRequest interface - `default_service_tier` in config schema + default.yaml - All 3 translation layers (OpenAI/Anthropic/Gemini) use parseModelName() Dashboard: - Standard / Fast speed toggle in ApiConfig - AnthropicSetup shows compound model name with suffixes - CodeExamples builds compound model name, suppresses redundant params Exampl…5416ffb
-
fix: remove unsupported previous_response_id parameter (#30)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* fix: remove unsupported previous_response_id parameter (#29) The Codex backend no longer accepts `previous_response_id`. Sending it causes HTTP 400: "Unsupported parameter: previous_response_id". Remove the injection logic in proxy-handler and clean up related dead code across translation functions and session manager. Closes #29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: remove dead SessionManager (was only used for previous_response_id) SessionManager, session hashing, and onResponseId session storage were only used to track previous_response_id across turns. Since the backend no longer supports this parameter, the entire session system is dead code. Remove it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: icebear0828 <icebear0828@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>3c0eaf7
-
refactor: extract startServer() + path abstraction for Electron reuse
icebear0828 +1: Claude Opus 4.6- Export startServer(options?) from src/index.ts so Electron can import it - Add src/paths.ts: centralized path getters (getConfigDir, getDataDir, etc.) with setPaths() hook for Electron to redirect to userData - Replace all process.cwd() calls with path getters across src/ - Extract shared/ from web/ (i18n, theme, hooks, utils) for desktop reuse - Add /desktop route in web.ts (serves desktop UI if built, no-op otherwise) CLI behavior is unchanged — all path getters default to process.cwd(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4a940a5 -
feat: add reasoning/thinking output support for OpenAI and Anthropic routes
icebear0828 +1: Claude Opus 4.6- Always send `summary: "auto"` to Codex API so reasoning summaries are available - Parse `response.reasoning_summary_text.delta/done` SSE events - OpenAI route: emit `reasoning_content` in chunks when client sends `reasoning_effort` - Anthropic route: emit thinking blocks when client sends `thinking.type: enabled/adaptive` - Extract block lifecycle helpers in Anthropic translator to eliminate duplication - Log unknown SSE events via console.debug for discovering new event types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>7366e72 -
fix: Anthropic route thinking blocks validation + context token display
icebear0828 +1: Claude Opus 4.6- Add thinking/redacted_thinking to Anthropic content block schema (fixes /compact 400 error with extended thinking history) - Include input_tokens in message_delta usage (fixes Claude Code always showing 0% context) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>be3a571 -
feat: add image input support for all API routes
icebear0828 +1: Claude Opus 4.6Previously all image content was silently discarded by the translation layer. Now image_url (OpenAI), image/base64 (Anthropic), and inlineData (Gemini) content parts are translated to Codex input_image format and passed through to the backend. Closes #25 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>142c9c4
-
fix: normalize tool schemas missing `properties` field
icebear0828 +1: Claude Opus 4.6MCP tools with no parameters send `{"type":"object"}` without a `properties` key. The Codex/OpenAI backend strictly requires it, returning 400. Add a shared `normalizeSchema()` helper that injects `properties: {}` when missing, applied consistently across all four format converters (OpenAI tools, OpenAI functions, Anthropic, Gemini). Thanks to @lookvincent for identifying this issue (PR #22). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2df0167
-
fix: detect empty Codex responses and auto-retry with account rotation (#18)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* fix: detect empty Codex responses and auto-retry with account rotation Codex API intermittently returns HTTP 200 with valid SSE events but zero text deltas. Add EmptyResponseError detection in all three translation layers (OpenAI, Anthropic, Gemini) and a retry loop in proxy-handler that switches accounts on empty responses (up to 3 attempts). - Non-streaming: catch EmptyResponseError → release account → acquire new account → retry with fresh CodexApi (max 2 retries) - Streaming: inject "[Error] Codex returned an empty response" text chunk when response.completed fires with no content - All retries exhausted → 502 with clear error message Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: prevent double-release of account in empty-response retry loop The outer catch block used the original entryId, which was already released when EmptyResponseError switched to a new account. Introduce activeEntryId to track the currently-active account across retries. Also set Em…9d6278d -
fix: harden prompt injection suppression and non-streaming error handling
icebear0828 +1: Claude Opus 4.6Strengthen SUPPRESS_PROMPT to prevent mini models from leaking Codex Desktop identity. Wrap collectTranslator in try/catch to return 502 JSON instead of 500 HTML on non-streaming errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2def35e -
fix: handle error SSE events from Codex API instead of silently dropping them
icebear0828 +1: Claude Opus 4.6When the Codex API returns `event: error` or `event: response.failed`, the proxy now surfaces the error message to clients instead of returning empty responses. Also detects non-SSE JSON error bodies from upstream. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>cf0807a
-
fix: support thinking.type "adaptive" for latest Claude Code
icebear0828 +1: Claude Opus 4.6Claude Code now sends thinking.type: "adaptive" (with optional budget_tokens) instead of always "enabled"/"disabled". Added the new variant to the Zod schema and translation logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>be3ca8e
-
feat: dynamic model list fetching from Codex backend (#9)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* feat: dynamic model list fetching from Codex backend Replace static-only model loading with a hybrid approach: - Static YAML models as fallback baseline - Background fetcher probes /codex/models and /models endpoints - Backend models merge into catalog (backend wins, YAML fills gaps) - Aliases always from YAML (user-customizable) - New /debug/models endpoint for diagnostics - All fetch errors non-fatal — gracefully falls back to static models Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: PR #9 review issues + complete Codex model catalog - Remove dead _backendModelCount variable from model-store - Fix hot-reload wiping backend models: add triggerImmediateRefresh() in model-fetcher, chain it in reloadAllConfigs() - Fix premature "hot-reloaded" log message ordering in config.ts - Gate raw model sample logging to first fetch only in codex-api - Remove dead re-exports from routes/models.ts - Expand getModels() to probe sentinel/chat-requirements + flatten nested …5f8456f
-
feat: OpenCode platform support, vitest tests, changelog & Docker hardening
icebear0828 +1: Claude Opus 4.6- Add opencode.json provider config for OpenCode IDE integration - Add CHANGELOG.md covering all versions (v0.1.0–v0.8.0) - Add vitest with unit tests for account-pool, codex-api, codex-event-extractor - Add request-id middleware to global middleware chain - Harden Dockerfile: non-root user, HEALTHCHECK probe - Simplify /health endpoint to return pool summary only Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>92c5df7 -
feat: native tool calling support across all protocols (#8)
icebear +2: icebear0828, Claude Opus 4.6Unverified signature* feat: native tool calling support across all protocols - Fix 500 errors: wrap c.req.json() in try-catch for all 3 routes, returning proper 400 responses for malformed JSON - Forward tool definitions to Codex API instead of sending tools: [] - Parse function call SSE events (output_item.added, function_call_arguments.delta/done) with item_id→call_id mapping - Translate tool calls back to each protocol's format: OpenAI: streaming tool_calls chunks + finish_reason "tool_calls" Anthropic: tool_use content blocks + stop_reason "tool_use" Gemini: functionCall parts in candidates - Convert tool results from each protocol to native function_call_output input items - New shared module: tool-format.ts for cross-protocol tool conversion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address review issues in native tool calling - Fix Gemini call_id collision: use counter-based IDs with name→callId correlation instead of fragile fc_${name} pattern - Remove dead c…ab2754a
-
feat: accept tool/function messages across all protocols
icebear0828 +1: Claude Opus 4.6Client frameworks (LangChain, AutoGen, Claude Code, etc.) often send conversation histories containing tool role messages and tool_calls. Previously, Zod validation rejected these requests outright. Since the Codex backend doesn't support tool calls, this implements a graceful degradation strategy: accept all tool-related fields in the schema, then flatten tool messages into human-readable text during translation. Covers both old (functions/function_call/role:function) and new (tools/tool_calls/role:tool) OpenAI formats, plus Anthropic (tool_use/tool_result) and Gemini (functionCall/functionResponse). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>759fe9e
-
feat: suppress Codex Desktop directives in model responses
icebear0828 +1: Claude Opus 4.6Keep desktop-context.md in instructions for client fingerprinting, but inject a suppress prompt to prevent the model from outputting desktop-specific directives (::automation-update, ::code-comment, ::archive) and mentioning Codex Desktop features. Controlled by config model.suppress_desktop_directives (default: true). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d817d67 -
feat: support developer role and array content in OpenAI protocol
icebear0828 +1: Claude Opus 4.6- Add "developer" to role enum (treated as system/instructions) - Accept array content parts (extract text, ignore non-text) - Flatten array content before passing to session manager Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>ebe8094 -
refactor: architecture audit fixes round 2 (P0-P2)
icebear0828 +1: Claude Opus 4.6- Fix curl subprocess leak on client disconnect (abort signal propagation) - Cap SSE parse buffer at 10MB to prevent memory exhaustion - Fatal error triggers graceful shutdown instead of hard exit - Session hash: 128-bit + JSON.stringify to prevent collisions - Gemini SSE line endings normalized to \n\n - Extract shared translation utils (desktop context, instructions, budgetToEffort) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d6c3bb0
-
refactor: fingerprint alignment, auto-maintenance, Docker deployment
icebear0828 +1: Claude Opus 4.6Phase 1 - Eliminate fingerprint detection gaps: - Dynamic sec-ch-ua from config chromium_version (aligned with TLS profile) - Inject full fingerprint headers into curl-fetch (OAuth/appcast) - Unify Accept-Encoding based on curl-impersonate detection - Optimize header ordering (single sort pass) Phase 2 - Auto-maintenance: - Structured YAML mutation utility (replace regex hacks) - Auto full-update pipeline on new version detection - Config hot-reload after updates - Exponential backoff token refresh (5 attempts + 10m recovery) - Immediate persistence for critical data (tokens, cf_clearance) - Cookie v2 format with expiry timestamps - Graceful shutdown with 10s timeout protection - Usage counters auto-reset on rate limit window rollover Phase 3 - Docker deployment: - Dockerfile, docker-compose.yml, .dockerignore - Deployment docs in README Fixes: - Extract planType from JWT /auth claim (was looking in /profile) - Backfill missing planType on startup for existing accounts - Show full d…347f81b -
feat: multi-protocol support — Anthropic Messages API + Google Gemini API
icebear0828 +1: Claude Opus 4.6Add two new protocol translation layers so the proxy can serve clients speaking Anthropic (/v1/messages) or Gemini (/v1beta/models/:model:generateContent) in addition to the existing OpenAI /v1/chat/completions endpoint. All three protocols translate to the same upstream Codex Responses API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d0eb8b9 -
feat: desktop context injection, multi-turn sessions, TLS impersonation & auto-update
icebear0828 +1: Claude Opus 4.6- Inject Codex Desktop system prompt into every request for full feature parity - Add previous_response_id for multi-turn conversation continuity - Add curl-impersonate auto-detection with Chrome TLS fingerprint fallback - Fix appcast XML parsing for element-style Sparkle tags - Remove private maintenance scripts from public repo - Add README with setup and usage instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>22a7de1
-
feat: architecture audit — disguise hardening, update automation, robustness
icebear0828 +1: Claude Opus 4.6Disguise hardening (P0): - Enforce HTTP header order from fingerprint.yaml config - Add browser-level headers (Accept-Encoding, Accept-Language) - Add Codex-specific request body fields (tools, previous_response_id) - Protect /debug/fingerprint endpoint (dev/localhost only) Update automation (P0-P1): - Integrate appcast version checker into server process (30-min polling) - Expose update state via /health endpoint - Externalize model catalog to config/models.yaml - Fail fast on critical extraction failures (originator, api_base_url) - Update apply-update.ts to compare models against YAML config Robustness (P0-P1): - Add 5xx retry with exponential backoff in chat route (max 2 retries) - Wrap HTML file reads in try-catch to prevent server crashes - Add config load try-catch with friendly error messages - Log persistence errors instead of silently swallowing - Add retry (1 attempt, 5s delay) for token refresh failures Code hygiene: - Delete leftover WHAM dist files - Mark 6 backward-co…85aec43 -
Initial commit: Codex Proxy with quota API and Cloudflare bypass
icebear0828 +1: Claude Opus 4.6OpenAI-compatible proxy that translates Chat Completions API to ChatGPT's Codex Responses API. Includes multi-account management, official quota querying via curl subprocess (bypasses Cloudflare TLS fingerprinting), per-account cookie jar, and full API documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>5d0a52f