Skip to content

[codex] Improve LiteLLM OpenAI Gemini dispatch#116

Merged
Tibo2403 merged 2 commits into
mainfrom
codex/litellm-openai-gemini-dispatch
Jun 27, 2026
Merged

[codex] Improve LiteLLM OpenAI Gemini dispatch#116
Tibo2403 merged 2 commits into
mainfrom
codex/litellm-openai-gemini-dispatch

Conversation

@Tibo2403

Copy link
Copy Markdown
Owner

What changed

  • Expanded the existing Codex LiteLLM router with task-oriented aliases: codex-light, codex-default, codex-long, and codex-deep.
  • Added weighted OpenAI/Gemini model groups, cooldowns, context-window fallbacks, pre-call checks, and health-check routing to litellm-cost-routing.yaml.
  • Updated the Python router to classify long-context work, support a gemini provider preference, and route complex work to codex-deep.
  • Updated the PowerShell launcher to request GEMINI_API_KEY as an optional in-memory secret and clear it on shutdown.
  • Refreshed docs and tests for the new dispatching behavior.

Security

  • API keys remain environment-variable only: no provider secrets are committed.
  • Ran the local high-confidence secret scan before pushing.

Validation

  • python -m unittest scripts.python.tests.test_codex_cost_router -> 18 tests passed.
  • LiteLLM YAML parsed successfully and verified simple-shuffle plus context fallbacks.
  • Secret scan: no high-confidence secret patterns found.

Copy link
Copy Markdown
Owner Author

Added the optional local web key session flow in dfe5cca.

What it adds:

  • scripts/python/codex_key_session_web.py: localhost-only page for entering OpenAI/Gemini/HF keys for one work session.
  • scripts/python/Start-CodexKeySessionWeb.ps1: starts the page on 127.0.0.1:8787.
  • scripts/python/Install-CodexLocalLiteLLMAssets.ps1: copies the local assets to ~/.codex/litellm-proxy and installs a config.yaml without master_key for Codex Desktop compatibility.

Security note: keys are passed only to the LiteLLM subprocess environment and are not written to disk; request logging is suppressed.

Validation rerun:

  • python -m unittest scripts.python.tests.test_codex_cost_router scripts.python.tests.test_codex_key_session_web -> 21 tests passed.
  • YAML validation OK.
  • Secret scan OK.

@Tibo2403 Tibo2403 marked this pull request as ready for review June 27, 2026 16:22
@Tibo2403 Tibo2403 merged commit e2ded57 into main Jun 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant