Change Codex’s reasoning effort and every request dies
with an error that looks like your server fell over —
one line back to auto and it’s instantly fine.
model = "auto" model = "gpt-5.6-sol"
│ │
┌─────▼─────┐ ┌─────▼─────┐
│ GATEWAY │ picks for you │ GATEWAY │ bypassed
└─────┬─────┘ └─────┬─────┘
│ │
free · free · free · paid one upstream, no fallback
│
✅ routing alive, limits absorbed ❌ Invalid request: Invalid input
╔══════════════════════════════════════════════════════════════╗
║ CODEX + OPENAI-COMPATIBLE GATEWAY FIELD NOTE ║
║ ║
║ Gateway working? Changed /model? Suddenly broken? ║
║ ║
║ CHECK THE MODEL SETTING FIRST. ║
╚══════════════════════════════════════════════════════════════╝
Landed here from this exact error? You’re in the right place:
{"error":{"message":"Invalid request: input: Invalid input","type":"invalid_request_error"}}
I hit this in OpenAI Codex CLI v0.152.1 against a custom OpenAI-compatible gateway. Posting it because the failure sends you troubleshooting in exactly the wrong direction — and because if you’re stacking free tiers behind a router, this is the thing that silently switches it off.
🧪 The proof — A/B test across two gateway profiles
What I Was Actually Trying To Do
I wasn’t really trying to change providers.
I simply wanted to change how much reasoning Codex used.
Something like:
LOW
↓
MEDIUM
↓
HIGH
But Codex’s model interface ties model selection and reasoning selection together closely enough that I ended up changing the configured model too.
My previously working gateway configuration effectively went from:
model = "auto"
model_reasoning_effort = "low"
to something like:
model = "gpt-5.6-sol"
model_reasoning_effort = "high"
And that was enough to break the requests.
The Evidence
I tested this against two independently configured gateway profiles.
The same Codex client was used.
The same gateway software was used.
Authentication remained valid.
No API keys were rotated during the A/B test.
No reverse-proxy configuration was changed.
No containers were rebuilt.
One meaningful variable was changed:
MODEL
Results
| Model configuration | Reasoning | Result |
|---|---|---|
| Explicit model | HIGH | |
| Explicit model | LOW | |
auto |
HIGH | |
auto |
MEDIUM |
The explicit model produced:
Invalid request: input: Invalid input
Changing only:
model = "gpt-5.6-sol"
back to:
model = "auto"
restored successful completions.
Proven Working State
One working profile ended with:
Model: auto
Reasoning: high
Provider: custom OpenAI-compatible gateway
Result: PASS
A second independently configured profile ended with:
Model: auto
Reasoning: medium
Provider: custom OpenAI-compatible gateway
Result: PASS
So reasoning effort itself was not the problem.
That was an important distinction.
The auto Warning Is NOT The Same Failure
When using:
model = "auto"
Codex currently displays:
Model metadata for `auto` not found.
Defaulting to fallback metadata; this can degrade performance and cause issues.
That warning looks ugly.
But in my testing it was non-fatal.
The completion still succeeded.
So we have two separate conditions:
┌──────────────────────────────────────────────┐
│ model = auto │
│ │
│ metadata warning appears │
│ ↓ │
│ request completes successfully │
│ │
│ PASS │
└──────────────────────────────────────────────┘
versus:
┌──────────────────────────────────────────────┐
│ explicit model selected │
│ ↓ │
│ request sent through custom gateway │
│ ↓ │
│ Invalid request: input: Invalid input │
│ │
│ FAIL │
└──────────────────────────────────────────────┘
Do not assume the auto metadata warning is the actual problem.
🛠️ The fix — 8 steps, inspect to rollback
Repair Procedure
The commands below are intentionally generic.
Replace:
~/.codex/my-gateway.config.toml
with your own custom-provider configuration file.
Do not publish your real API keys, gateway hostname, IP addresses, usernames, internal paths, VM/container identifiers, or session IDs.
▶ 1. Inspect the current Codex gateway profile
This changes nothing.
CONFIG="$HOME/.codex/my-gateway.config.toml"
grep -E \
'^(model|model_provider|model_reasoning_effort)[[:space:]]*=' \
"$CONFIG"
A broken profile may look similar to:
model = "gpt-5.6-sol"
model_provider = "my_gateway"
model_reasoning_effort = "high"
▶ 2. Back up the profile BEFORE changing anything
Always preserve the original first.
CONFIG="$HOME/.codex/my-gateway.config.toml"
BACKUP="${CONFIG}.before-auto-repair-$(date +%Y%m%d-%H%M%S)"
cp -a "$CONFIG" "$BACKUP"
echo "BACKUP=$BACKUP"
▶ 3. Restore gateway-controlled model routing
Change only the model setting:
CONFIG="$HOME/.codex/my-gateway.config.toml"
sed -i \
's/^model[[:space:]]*=.*/model = "auto"/' \
"$CONFIG"
▶ 4. Set reasoning effort independently
For MEDIUM:
CONFIG="$HOME/.codex/my-gateway.config.toml"
sed -i \
's/^model_reasoning_effort[[:space:]]*=.*/model_reasoning_effort = "medium"/' \
"$CONFIG"
Other commonly used values are:
low
medium
high
The important part is that reasoning effort can remain independent from gateway model routing.
▶ 5. Verify the repaired profile
CONFIG="$HOME/.codex/my-gateway.config.toml"
grep -E \
'^(model|model_provider|model_reasoning_effort)[[:space:]]*=' \
"$CONFIG"
Expected:
model = "auto"
model_provider = "my_gateway"
model_reasoning_effort = "medium"
▶ 6. Test with the smallest possible completion
Start Codex through your custom provider and send something trivial:
Reply exactly: GATEWAY AUTO TEST OK
You are looking for:
GATEWAY AUTO TEST OK
Do not start rebuilding infrastructure until this test has been attempted.
▶ 7. Confirm the provider with /status
Inside Codex:
/status
Confirm that the session is actually using your custom provider.
A sanitized example:
Model: auto
Reasoning: medium
Model provider: My OpenAI-Compatible Gateway
Directory: ~/project
This step matters.
A successful response is much stronger evidence if you can also prove that Codex did not silently fall back to another provider.
▶ 8. Roll back if necessary
If the experiment makes things worse:
CONFIG="$HOME/.codex/my-gateway.config.toml"
BACKUP="$HOME/.codex/my-gateway.config.toml.before-auto-repair-YYYYMMDD-HHMMSS"
cp -a "$BACKUP" "$CONFIG"
Use the actual timestamped backup filename created earlier.
🧰 The script — does all 8 steps for you
Small Standalone Repair Script
This is a generic helper for people who hit the same problem.
It:
- validates the requested reasoning level;
- verifies that the configuration exists;
- creates a timestamped backup;
- restores
model = "auto"; - sets reasoning independently;
- prints only non-secret model settings;
- never asks for or prints an API key.
▶ Codex OpenAI-Compatible Gateway Profile Repair Script
Save as:
codex-gateway-auto-repair.sh
#!/usr/bin/env bash
set -euo pipefail
CONFIG="${1:-$HOME/.codex/config.toml}"
EFFORT="${2:-medium}"
case "$EFFORT" in
low|medium|high)
;;
*)
echo "ERROR: reasoning effort must be low, medium, or high"
echo
echo "Usage:"
echo " $0 [config-file] [low|medium|high]"
exit 2
;;
esac
if [ ! -f "$CONFIG" ]; then
echo "ERROR: configuration file not found:"
echo "$CONFIG"
exit 1
fi
BACKUP="${CONFIG}.before-auto-repair-$(date +%Y%m%d-%H%M%S)"
echo
echo "============================================================"
echo " CODEX OPENAI-COMPATIBLE GATEWAY PROFILE REPAIR"
echo "============================================================"
echo
echo "CONFIG : $CONFIG"
echo "BACKUP : $BACKUP"
echo "EFFORT : $EFFORT"
echo
cp -a "$CONFIG" "$BACKUP"
if grep -q '^model[[:space:]]*=' "$CONFIG"; then
sed -i \
's/^model[[:space:]]*=.*/model = "auto"/' \
"$CONFIG"
else
sed -i \
'1i model = "auto"' \
"$CONFIG"
fi
if grep -q '^model_reasoning_effort[[:space:]]*=' "$CONFIG"; then
sed -i \
"s/^model_reasoning_effort[[:space:]]*=.*/model_reasoning_effort = \"$EFFORT\"/" \
"$CONFIG"
else
sed -i \
"2i model_reasoning_effort = \"$EFFORT\"" \
"$CONFIG"
fi
echo "CURRENT NON-SECRET MODEL SETTINGS:"
echo
grep -E \
'^(model|model_provider|model_reasoning_effort)[[:space:]]*=' \
"$CONFIG" || true
echo
echo "============================================================"
echo " REPAIR COMPLETE"
echo "============================================================"
echo
echo "Rollback copy:"
echo "$BACKUP"
echo
echo "Next:"
echo " Start Codex through your custom gateway."
echo " Send a tiny test completion."
echo " Confirm the provider with /status."
echo
Make executable:
chmod +x codex-gateway-auto-repair.sh
Example:
./codex-gateway-auto-repair.sh \
"$HOME/.codex/my-gateway.config.toml" \
medium
🤔 Why this is sneaky — where people waste hours instead
Why This Failure Is So Misleading
When the request starts returning:
Invalid request: input: Invalid input
a normal administrator may reasonably start checking:
┌───────────────┐
│ CODEX │
└───────┬───────┘
│
▼
┌───────────────┐
│ API KEY │
└───────┬───────┘
│
▼
┌───────────────┐
│ TLS / DNS │
└───────┬───────┘
│
▼
┌───────────────┐
│ NGINX / PROXY │
└───────┬───────┘
│
▼
┌───────────────┐
│ LLM GATEWAY │
└───────┬───────┘
│
▼
┌───────────────┐
│ PROVIDER KEY │
└───────┬───────┘
│
▼
┌───────────────┐
│ UPSTREAM API │
└───────────────┘
You can burn hours proving every layer.
But if all of that worked five minutes ago, first inspect:
model =
Sometimes the entire infrastructure is healthy.
The client has simply stopped asking the gateway to route the request the way it was designed to.
💡 Wishlist — 4 things that would stop this happening at all
Improvements I Would Like To See
1. Give Default / Auto a first-class option
If a custom provider is configured with:
model = "auto"
the model interface should allow the user to retain it.
Something like:
Model:
▶ Default / Gateway Auto
model-a
model-b
model-c
2. Separate reasoning effort from model selection
This was the original reason I found the problem.
I wanted to change:
reasoning:
LOW → MEDIUM
I did not necessarily want:
model:
AUTO → EXPLICIT MODEL
Those are conceptually different settings.
They should be independently adjustable.
3. Recognize router semantics
For an OpenAI-compatible router:
CODEX
│
│ model = auto
▼
┌─────────────┐
│ GATEWAY │
└──────┬──────┘
│
┌───────┼────────┐
▼ ▼ ▼
Provider A Provider B Provider C
auto does not necessarily mean:
unknown model
It may mean:
Gateway, you decide.
That is intentional architecture.
4. Warn before overriding it
A warning like this would help tremendously:
This custom provider is currently configured with:
model = "auto"
Selecting a specific model may override routing performed by
your OpenAI-compatible gateway.
Continue? [y/N]
🔐 Safety before you post logs + the field rule
Public Troubleshooting Safety
Before posting your configuration or logs publicly, remove or sanitize:
API keys
Bearer tokens
access tokens
session IDs
gateway hostnames
public IP addresses
private IP addresses
SSH information
usernames
real filesystem paths
VM/container identifiers
internal network names
provider credentials
authorization headers
cookie values
database credentials
A good technical bug report should reveal:
software behavior
configuration semantics
error messages
A/B test results
reproduction method
recovery method
It should not provide strangers with an infrastructure map.
Field Troubleshooting Rule
╔═══════════════════════════════════════════════════════════════╗
║ EVIDENCE BEATS MEMORY ║
╠═══════════════════════════════════════════════════════════════╣
║ ║
║ What was true before? ║
║ ║
║ What changed? ║
║ ║
║ Why did it change? ║
║ ║
║ What proves the new state? ║
║ ║
║ Where is the recovery artifact? ║
║ ║
║ How do we roll it back? ║
║ ║
║ What is still unknown? ║
║ ║
╚═══════════════════════════════════════════════════════════════╝
In this case:
BEFORE
│
└── model = auto
│
▼
PASS
CHANGE
│
└── explicit model selected
│
▼
FAIL
A/B TEST
│
└── model restored to auto
│
▼
PASS
That’s enough.
Don’t rebuild the bridge after you’ve already proven the bridge isn’t broken.
Bottom Line
With the tested combination of:
OpenAI Codex CLI v0.152.1
+
Custom OpenAI-compatible provider
+
Gateway-controlled routing
an explicitly selected model produced reproducible:
Invalid request: input: Invalid input
on two separate custom-provider profiles.
Restoring:
model = "auto"
restored successful completions on both.
Reasoning effort was successfully tested independently at:
HIGH
and:
MEDIUM
So if your previously functioning Codex gateway suddenly starts throwing:
Invalid request: input: Invalid input
after using /model:
check the persisted model configuration before touching the rest of your infrastructure.
You may save yourself several hours.
╔══════════════════════════════════════════════════════════════╗
║ BRIDGE CROSSED ║
║ ║
║ Change one variable. ║
║ Preserve the evidence. ║
║ Keep the rollback. ║
║ Move forward. ║
╚══════════════════════════════════════════════════════════════╝
Built and field-tested collaboratively by
William James / Mikey_LikesIT
ChatGPT / OpenAI — GPT-5.6 Sol
For the BCBC community and anyone else building their own AI infrastructure.
──────────────────────────────────────────────────────────────
ALTERED REALITY
In memory of Ron Phillips
R.I.P., my friend.
──────────────────────────────────────────────────────────────
!