Proxy Codex model discovery through CodeRouter

Merged
LA
3mo ago
+121-0

Summary

  • add authenticated /v1/models support for Codex model discovery
  • forward through the selected Stack-vault account
  • preserve account cooldown/failover behavior
  • prevent Codex startup from logging a Next.js HTML 404

Test plan

  • focused CodeRouter suite: 12 passed
  • bun run typecheck

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Expose an authenticated /v1/models endpoint in CodeRouter that proxies Codex model discovery through the selected vault-backed Codex account. Preserves cooldown/failover behavior and stops the Codex startup 404 log.

  • New Features

    • Proxies to https://chatgpt.com/backend-api/codex/models, forwarding query params and using the account’s accessToken.
    • Retries on 429s and marks account cooldown before failing over to the next account.
    • Adds a focused test for the models proxy.
  • Bug Fixes

    • Serve the models route dynamically to prevent a Next.js HTML 404 during Codex startup.