Spaces:
Sleeping
Sleeping
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
-
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
-
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: support thinking/redacted_thinking content blocks in Anthropic schema
icebear0828 +1: Claude Opus 4.6Claude Code /compact sends conversation history containing thinking and redacted_thinking content blocks which were rejected by the Zod schema. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>ca7b1cb -
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: 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: 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: 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: 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 -
refactor: extract shared proxy handler, eliminate route duplication
icebear0828 +1: Claude Opus 4.6- Extract withRetry() to src/utils/retry.ts (was duplicated 3x) - Create shared proxy-handler.ts encapsulating acquire/stream/release lifecycle - Refactor chat.ts, messages.ts, gemini.ts to use shared handler (-264 lines net) - Convert models.ts from default export to named createModelRoutes() - Extract GEMINI_STATUS_MAP to types/gemini.ts (was duplicated in error-handler) - Add SessionManager.destroy() with interval cleanup + unref - Remove dead captureCookies() method from codex-api.ts - Add stack trace logging to error handler - Fix hardcoded localhost in startup message - Use atomic write-to-temp-then-rename for cookie-jar and account-pool - Add warning logs for previously silent catch blocks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8b777a2 -
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
-
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