Skip to content

codex-responses-api-proxy rejects base64 API keys, blocking responses-api-endpoint (e.g. Bedrock bearer tokens) #127

Open

Description

@pabloskubert

Summary

codex-responses-api-proxy validates the API key against [A-Za-z0-9_-] and refuses anything else. That makes the responses-api-endpoint (bring-your-own-endpoint) path unusable with any provider whose credential is base64, because the key is the only way to get an Authorization: Bearer value to that endpoint.

Concrete case: AWS Bedrock's OpenAI-compatible /openai/v1/responses endpoint takes a bearer token that is base64 (~460 chars, = padding). The action never reaches the model:

Error: API key may only contain ASCII letters, numbers, '-' or '_'
responses-api-proxy did not write server info   -> exit 1

Why it can't be worked around

The action has exactly one credential input, and it goes straight into the proxy (action.yml, "Start Responses API proxy"):

env:
  PROXY_API_KEY: ${{ inputs['openai-api-key'] }}
  UPSTREAM_URL: ${{ inputs['responses-api-endpoint'] }}
run: |
  printenv PROXY_API_KEY | env -u PROXY_API_KEY "${args[@]}"

responses-api-endpoint only swaps the upstream URL, so there is no separate place to put the upstream Authorization value. Transforming the key to satisfy the charset is not an option either: the proxy forwards it verbatim, so stripping or re-encoding it just fails auth at the provider.

Worth noting the failure is also misreported. The proxy prints the real error, but the step is backgrounded and reports outcome=success; the job fails ~10s later on the generic responses-api-proxy did not write server info, and run_codex is skipped. Anyone hitting this sees a message about a missing file rather than a rejected key.

Possible fixes, in order of how little they'd change

  1. Relax the proxy's key validation (or gate it on the default endpoint). The restriction looks aimed at OpenAI-issued keys; when the caller supplies their own upstream, the key format is the provider's business.
  2. Let the upstream credential be passed separately, e.g. upstream-authorization / --upstream-header, so openai-api-key stays an OpenAI concern.
  3. Failing either, surface the proxy's stderr on the failing step so the cause is visible.

Related: #107 asks for first-class Bedrock support. This is narrower — the transport already works, one validation blocks it — so fixing it would unblock Bedrock (and Azure/any gateway with a non-alphanumeric key) without a new provider abstraction.

Environment

openai/codex-action@v1, GitHub-hosted ubuntu-latest, responses-api-endpoint pointed at AWS Bedrock's OpenAI-compatible endpoint, sandbox: read-only, safety-strategy: drop-sudo.

Activity

  1. ruby077113 commented on Aug 21, 2026

    @ruby077113

    Hit the same thing on openai/codex-action@v1 against Bedrock's OpenAI-compatible endpoint. Same symptom, same dead end.

    Worth emphasising the third suggestion above — the misreported failure cost us far more time than the validation itself. All we saw was:

    responses-api-proxy did not write server info
    Error: Process completed with exit code 1

    The proxy step reports outcome=success and its stderr is gone with the backgrounded shell, so the real message ("API key may only contain ASCII letters, numbers, '-' or '_'") never surfaces. We went looking at IAM policies and endpoint URLs before finding this issue.

    One extra data point for prioritisation: the Codex CLI itself already has first-class Bedrock support — model_providers.amazon-bedrock with native SigV4 auth, no bearer token involved at all. So we dropped the action and
    call codex exec directly:

    model = "openai.gpt-5.6-terra"
    model_provider = "amazon-bedrock"
    
    [model_providers.amazon-bedrock.aws]
    region = "us-east-1"

    That works today and is arguably better than the bearer-token path (short-lived OIDC credentials, no static key in repo secrets). But it means giving up the action's proxy isolation, which is the whole reason the proxy exists. Relaxing the validation (option 1) would let people keep both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions