Skip to content

feat(codex): OPENAI_CUSTOM_HEADERS via the custom provider's http_headers - #36

Merged
gjtorikian merged 1 commit into
mainfrom
feat/codex-custom-headers
Oct 16, 2026
Merged

gjtorikian merged 1 commit into
mainfrom
feat/codex-custom-headers

Conversation

@gjtorikian

Copy link
Copy Markdown
Collaborator

Summary

  • Adds OPENAI_CUSTOM_HEADERS (Name: Value lines, the Codex counterpart of ANTHROPIC_CUSTOM_HEADERS) to the codex adapter's optionalHostEnv. It is rendered as http_headers on the custom model provider that the OPENAI_BASE_URL override already produces; headers alone render the provider against the vendor's default endpoint.
  • Codex has no env channel for extra request headers, so the values land in config.toml inside the attempt container: the same trust boundary as the env that already carries them, written over stdin, gone with the container. The module comment spells this out.
  • The adapter context now carries every declared override, header bundles included (never the provider keys); the manifest still records only the non-secret endpoint URLs.
  • The key probe sends the custom headers too, so a gateway that needs them on GET /models still preflights correctly.
  • Unset overrides render nothing: with no *_BASE_URL or *_CUSTOM_HEADERS, both agents stay vendor-direct exactly as before. Tests cover both-set, headers-only, base-only and nothing-set, including JSON-valued headers surviving TOML escaping.

… http_headers

Codex has no env channel for extra request headers, so the counterpart of
Claude Code's ANTHROPIC_CUSTOM_HEADERS lands in config.toml on the custom
model provider the OPENAI_BASE_URL override already renders (headers alone
keep the vendor endpoint). A cf-aig-metadata line lets a gateway attribute
the traffic per app. The adapter context now carries every declared
override, header bundles included; anything rendered from them is written
only inside the attempt container. Unset overrides still render nothing:
vendor-direct remains the default.
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds OPENAI_CUSTOM_HEADERS to Codex configuration and its preflight request.

  • Codex can send custom request headers through its provider config.

No actionable issues were found. Tests were inspected, not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  H["Host overrides"] --> P["Preflight request"]
  H --> C["Attempt context"]
  C --> T["Codex config.toml inside container"]
  T --> A["Codex requests"]
  H --> F["Remove secret-named values"]
  F --> M["Manifest endpoints"]
Loading

Reviews (1) · Last reviewed commit: "feat(codex): OPENAI_CUSTOM_HEADERS, rend..." · Reviewed by Greptile

@gjtorikian
gjtorikian merged commit 6596106 into main Oct 16, 2026
13 checks passed
@gjtorikian
gjtorikian deleted the feat/codex-custom-headers branch October 16, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant