When a developer sees "We're currently experiencing high demand, which may cause temporary errors", the error can come from two sources:
The OpenAI API itself returns a 503 or error message during high load. The proxy forwards it unchanged.
How to verify:
./scripts/check-response-origin.sh "high demand"
./scripts/check-response-origin.sh "temporary errors"If the script finds the text in S3 logs, the origin is OpenAI. Nothing to do on the proxy side.
If all reserved concurrency slots (25) are in use, new requests get throttled.
Check:
aws cloudwatch get-metric-statistics --region us-east-1 \
--namespace AWS/Lambda --metric-name Throttles \
--dimensions Name=FunctionName,Value=codex-proxy \
--start-time "$(date -u -v-1H '+%Y-%m-%dT%H:%M:%SZ')" \
--end-time "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
--period 300 --statistics SumFix: Increase reserved concurrency in deploy.sh (change --reserved-concurrent-executions).
The proxy returns 401 for:
- Missing Authorization header: Developer didn't set
OPENAI_API_KEY(which should contain their proxy token) - Invalid or disabled token: Token not in DynamoDB or
enabled = false
Check token in DynamoDB:
aws dynamodb get-item --region us-east-1 --table-name codex-proxy-tokens \
--key '{"token": {"S": "the-token"}}'Codex CLI may send requests to /responses instead of /v1/responses. The proxy automatically normalizes paths without /v1 prefix by prepending /v1.
powershell -ExecutionPolicy Bypass -File scripts\setup-windows.ps1- Create
%USERPROFILE%\.codex\config.toml:
model_provider = "codexproxy"
forced_login_method = "api"
[model_providers.codexproxy]
name = "Codex Proxy"
base_url = "https://YOUR_FUNCTION_URL.lambda-url.REGION.on.aws/v1"
env_key = "OPENAI_API_KEY" # Codex reads this env var; the value is the proxy token, not an OpenAI key-
Set user environment variables:
OPENAI_BASE_URL=https://YOUR_FUNCTION_URL.lambda-url.REGION.on.awsOPENAI_API_KEY= your proxy token (not an OpenAI API key)
-
Open a new terminal and run
codex.
The proxy stores the full response_body from OpenAI in S3. To determine if an error message comes from OpenAI or the proxy:
# Search recent logs for a specific error message
./scripts/check-response-origin.sh "high demand"
# Search more logs
CHECK_ORIGIN_MAX=50 ./scripts/check-response-origin.sh "temporary errors"Proxy-generated errors have these specific messages:
missing or invalid Authorization headerinvalid or disabled tokentoken lookup failedupstream request failedinternal error
Any other error text in the response comes from OpenAI.
Run the full validation suite:
./scripts/validate.shThis checks:
- Lambda exists and has recent invocations
- CloudWatch Logs have recent entries
- DynamoDB has registered tokens
- S3 has today's logs
- Secrets Manager has the OpenAI key