[BUG] claude -p handles beta flags differently than without -p
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
claude is working when invoked in interactive mode via litellm with settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://litellm.ccri.com",
"ANTHROPIC_AUTH_TOKEN": "sk-myomy-actualtoken",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "litellm-fips-sonnet-4-5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "litellm-fips-sonnet-4-5",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
},
"permissions": {
"allow": [
"Bash(find *)",
"Bash(ls *)"
],
"deny": [
"WebSearch",
"WebFetch"
]
}
}
but fails with API Error: 400 {"error":{"message":"{\"message\":\"invalid beta flag\"}. Received Model Group=litellm-fips-sonnet-4-5\nAvailable Model Group Fallbacks=None","type":"None","param":"None","code":"400"}} when invoked with the -p / --print flag.
What Should Happen?
claude and claude -p should handle experimental beta flags the same way.
Error Messages/Logs
claude -p "some prompt"
produces:
`API Error: 400 {"error":{"message":"{\"message\":\"invalid beta flag\"}. Received Model Group=litellm-fips-sonnet-4-5\nAvailable Model Group Fallbacks=None","type":"None","param":"None","code":"400"}}`
Steps to Reproduce
Set up connection via litellm.
Make sure ANTHROPIC_AUTH_TOKEN is NOT set as an environment variable or the shell invoking claude.
Run claude -p "some prompt", observe that settings from ~/.claude/settings.json do not get used.
If ANTHROPIC_AUTH_TOKEN is set, then the settings from ~/.claude/settings.json do get loaded, and claude -p "some prompt" does work.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.31
Platform
AWS Bedrock
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗