MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _setup_codex

Function _setup_codex

uncommon_route/cli.py:1725–1762  ·  view source on GitHub ↗
(args: list[str])

Source from the content-addressed store, hash-verified

1723
1724
1725def _setup_codex(args: list[str]) -> None:
1726 from uncommon_route.proxy import DEFAULT_PORT
1727
1728 flags, _ = _parse_flags(args, {"port": True})
1729 port = int(flags.get("port", DEFAULT_PORT))
1730 rc = _detect_rc_file()
1731 upstream_val, key_display, status = _setup_env_display()
1732
1733 print(f"""
1734 UncommonRoute + OpenAI Codex
1735 {'=' * 40}
1736
1737 Add to {rc}:
1738
1739 # --- UncommonRoute proxy ---
1740 export UNCOMMON_ROUTE_UPSTREAM="{upstream_val}"
1741 export UNCOMMON_ROUTE_API_KEY="{key_display}"
1742
1743 # --- Codex → UncommonRoute ---
1744 export OPENAI_BASE_URL="http://localhost:{port}/v1"
1745 export OPENAI_API_KEY="not-needed"
1746
1747 Then:
1748
1749 1. source {rc}
1750 2. uncommon-route serve (terminal 1)
1751 3. codex (terminal 2)
1752
1753 How it works:
1754
1755 Codex --POST /v1/chat/completions--> UncommonRoute --best model--> Upstream API
1756 (smart routing)
1757
1758 - Set model to "uncommon-route/auto" for smart routing.
1759 - Auth is managed by the proxy. Codex does not need a real API key.
1760 - Non-virtual model names are passed through unchanged.
1761""")
1762 print(f" Status: {status}")
1763
1764
1765def _setup_openai(args: list[str]) -> None:

Callers

nothing calls this directly

Calls 4

_parse_flagsFunction · 0.85
_detect_rc_fileFunction · 0.85
_setup_env_displayFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected