Skip to content

Custom API Endpoints doesn't work #20997

@MH0386

Description

@MH0386

I tried to use the new Custom API Endpoints via Environment Variables, but it seems to have a bug.

I added this:

engine:
  id: codex
  model: "openrouter/free"
  env:
    OPENAI_BASE_URL: "https://openrouter.ai/api/v1"
    OPENAI_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}

But I found this in the agent job log. It seems to use gpt-5.3-codex model.

2026-03-14T22:21:22.758990Z DEBUG session_init: codex_core::codex: Configuring session: model=gpt-5.3-codex; provider=ModelProviderInfo { name: "OpenAI", base_url: Some("http://172.30.0.30:10000/v1"), env_key: None, env_key_instructions: None, experimental_bearer_token: None, wire_api: Responses, query_params: None, http_headers: Some({"version": "0.114.0"}), env_http_headers: Some({"OpenAI-Organization": "OPENAI_ORGANIZATION", "OpenAI-Project": "OPENAI_PROJECT"}), request_max_retries: None, stream_max_retries: None, stream_idle_timeout_ms: None, requires_openai_auth: true, supports_websockets: true }

Knowing that I tried to configure Codex locally with the same base URL (https://openrouter.ai/api/v1) and model (openrouter/free), and it works properly.

~/.codex/config.toml:

model_provider = "openrouter"
model="openrouter/free"

[model_providers.openrouter]
name = "openrouter"
base_url="https://openrouter.ai/api/v1"
env_key="OPENROUTER_API_KEY"

The agent summary:

Agentic Conversation
Conversation:

Agent: stream disconnected before completion: stream closed before response.completed

Agent: Reconnect attempts: 5/5

Statistics:
MCP Gateway
  • startup MCPG Gateway version: v0.1.15
  • startup Starting MCPG with config: stdin, listen: 0.0.0.0:80, log-dir: /tmp/gh-aw/mcp-logs/
  • startup Loaded 2 MCP server(s): [github safeoutputs]
  • startup Guards sink server ID logging enrichment disabled
  • backend
    Successfully connected to MCP backend server, command=docker
    
  • 🔍 rpc githubtools/list
  • 🔍 rpc safeoutputstools/list
  • 🔍 rpc safeoutputsresp {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"create_pull_request","description":"Create a new GitHub pull request to propose code changes. Use this after making file edits to submit them for review and merging. The PR will be created from the current branch with your committed changes. For code review comments on an existing PR, use create_pull_request_review_comment instead. CONSTRAINTS: Maximum 1 pull request(s) can be created. Title will be prefixed with \"[code-simplifier] \". Labels [\"refactori...
  • 🔍 rpc githubresp {"jsonrpc":"2.0","id":1,"result":{"tools":[{"annotations":{"readOnlyHint":true,"title":"Get commit details"},"description":"Get details for a commit from a GitHub repository","inputSchema":{"properties":{"include_diff":{"default":true,"description":"Whether to include file diffs and stats in the response. Default is true.","type":"boolean"},"owner":{"description":"Repository owner","type":"string"},"page":{"description":"Page number for pagination (min 1)","minimum":1,"type":"number"},"perPage":{"descriptio...
  • startup Starting in ROUTED mode on 0.0.0.0:80
  • startup Routes: /mcp/ for servers: [github safeoutputs]
Firewall Activity

▼ 6 requests | 6 allowed | 0 blocked | 1 unique domain

Domain Allowed Denied
openrouter.ai 6 0

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions