feat(auth): support x-api-key for proxy API key auth#844
Conversation
Accept codex-lb API keys from either Authorization: Bearer or x-api-key across the proxy auth path, with Authorization tried first and x-api-key used as a fallback when needed. This is primarily to support clients like Pi custom providers using the openai-codex-responses API type against codex-lb, where sending x-api-key is the practical integration path while keeping existing Bearer-based flows intact.
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Hermes owner-review blocker: Evidence:
Result: when Please preserve the validated proxy API key credential for internal owner-forward re-auth (or otherwise make internal bridge auth use the already-validated reservation/context safely) and add a regression test for owner-forward with |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Supports
x-api-keyalongside Bearer tokens for proxy-facing API key authentication so compatible clients and reverse proxies can authenticate without header rewrites. Authorization remains the preferred source when both are present, withx-api-keyused as a fallback only when needed.Type of change
feat:— new user-facing feature or capabilityfix:— bug fix (no behavior change beyond the bug)refactor:— internal refactor (no behavior change, no API change)docs:— documentation onlychore:/ci:/build:— tooling, CI, packagingtest:— test-only change!after the type, e.g.feat!:or includeBREAKING CHANGE:footer)Linked issue:
OpenSpec
shape, SSE framing, OAuth flow) and preserves upstream-equivalent behavior
Change directory:
openspec/changes/support-x-api-key-auth/Changes
x-api-keyfor proxy API key validation and self-service usage lookup.x-api-keywhen Authorization is absent, malformed, or invalid.x-api-keyfrom proxied requests.Test plan
Screenshots / output (optional)
Example behavior:
Authorization: Bearer+x-api-key:now authenticates successfullyGET /v1/usageaccepts a validx-api-keyx-api-keyis ignored for Bearer-only caller identity pathsChecklist
()?:).openai-codex-responses) needsx-api-keysupport to use codex-lb without header rewrites.uv run pre-commit run local-ci --hook-stage manual --all-filesor the relevantmakesubset locally.openspec validate --specspasses and/opsx:verifyis clean.