mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-06 16:31:08 +00:00
Codex CLI's OPENAI_BASE_URL env var approach causes "Invalid Responses API request" errors because OpenRouter doesn't fully support the Responses API wire format via base URL override. Switch all 8 codex scripts to use ~/.codex/config.toml with model_provider="openrouter" which uses the native OpenRouter integration. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
799 B
Bash
32 lines
799 B
Bash
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
# Source common functions - try local file first, fall back to remote
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
|
if [[ -f "${SCRIPT_DIR}/lib/common.sh" ]]; then
|
|
source "${SCRIPT_DIR}/lib/common.sh"
|
|
else
|
|
eval "$(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/local/lib/common.sh)"
|
|
fi
|
|
|
|
log_info "Codex CLI on local machine"
|
|
echo ""
|
|
|
|
agent_install() {
|
|
install_agent "Codex CLI" "npm install -g @openai/codex" cloud_run
|
|
}
|
|
|
|
agent_env_vars() {
|
|
generate_env_config \
|
|
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
|
}
|
|
|
|
agent_configure() {
|
|
setup_codex_config "${OPENROUTER_API_KEY}" cloud_upload cloud_run
|
|
}
|
|
|
|
agent_launch_cmd() {
|
|
echo 'source ~/.zshrc 2>/dev/null; codex'
|
|
}
|
|
|
|
spawn_agent "Codex CLI"
|