Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ if ($Global) {
$envObj | Add-Member -NotePropertyName ANTHROPIC_AUTH_TOKEN -NotePropertyValue $ApiKey -Force
$envObj | Add-Member -NotePropertyName ANTHROPIC_MODEL -NotePropertyValue $Model -Force
$envObj | Add-Member -NotePropertyName ANTHROPIC_SMALL_FAST_MODEL -NotePropertyValue $Model -Force
# The gateway rejects Claude Code's adaptive-thinking parameter; see the
# launcher for the full note. Remove when the gateway accepts "adaptive".
$envObj | Add-Member -NotePropertyName MAX_THINKING_TOKENS -NotePropertyValue '0' -Force
$cfg | Add-Member -NotePropertyName env -NotePropertyValue $envObj -Force
}
Write-RawText $Settings ($cfg | ConvertTo-Json -Depth 100)
Expand Down
6 changes: 5 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ write_settings() {
"ANTHROPIC_BASE_URL": "$GATEWAY_URL",
"ANTHROPIC_AUTH_TOKEN": "$API_KEY",
"ANTHROPIC_MODEL": "$MODEL",
"ANTHROPIC_SMALL_FAST_MODEL": "$MODEL"
"ANTHROPIC_SMALL_FAST_MODEL": "$MODEL",
"MAX_THINKING_TOKENS": "0"
},
"statusLine": { "type": "command", "command": "'$statusline_cmd'" }
}
Expand Down Expand Up @@ -510,6 +511,9 @@ if os.environ["QC_GLOBAL"] == "1":
env["ANTHROPIC_AUTH_TOKEN"] = os.environ["QC_TOKEN"]
env["ANTHROPIC_MODEL"] = os.environ["QC_MODEL"]
env["ANTHROPIC_SMALL_FAST_MODEL"] = os.environ["QC_MODEL"]
# The gateway rejects Claude Code's adaptive-thinking parameter; see the
# launcher for the full note. Remove when the gateway accepts "adaptive".
env["MAX_THINKING_TOKENS"] = "0"
tmp = path + ".qbraid-code.tmp"
with open(tmp, "w") as fh:
json.dump(data, fh, indent=2)
Expand Down
8 changes: 8 additions & 0 deletions qbraid-code
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ command -v claude >/dev/null 2>&1 || {
# accepts. ANTHROPIC_API_KEY would work too, but it makes Claude Code ask the
# user to approve a custom API key on first run — a prompt with no good answer
# for someone who just wants to start working.
#
# MAX_THINKING_TOKENS=0: recent Claude Code sends `thinking: {type: "adaptive"}`,
# which the gateway's Anthropic surface rejects (it accepts enabled|disabled —
# qbraid-api ai-request.validators.ts), turning every request into a 400.
# FORCED, not defaulted: an inherited MAX_THINKING_TOKENS from the user's
# shell re-enables thinking and turns every request into that 400. Remove the
# whole line once the gateway accepts "adaptive".
MAX_THINKING_TOKENS=0 \
ANTHROPIC_BASE_URL="$BASE_URL" \
ANTHROPIC_AUTH_TOKEN="$TOKEN" \
ANTHROPIC_MODEL="$MODEL" \
Expand Down
5 changes: 5 additions & 0 deletions qbraid-code.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ rem ANTHROPIC_AUTH_TOKEN sends `Authorization: Bearer <key>`, which the gateway
rem accepts. ANTHROPIC_API_KEY would work too, but it makes Claude Code ask the
rem user to approve a custom API key on first run - a prompt with no good answer
rem for someone who just wants to start working.
rem MAX_THINKING_TOKENS=0: recent Claude Code sends thinking type "adaptive",
rem which the gateway rejects (accepts enabled/disabled only) - every request
rem would 400. Forced: an inherited value re-enables thinking and breaks every
rem request. Remove once the gateway accepts adaptive.
set "MAX_THINKING_TOKENS=0"
set "ANTHROPIC_BASE_URL=%QBRAID_CODE_BASE_URL%"
set "ANTHROPIC_AUTH_TOKEN=%QBRAID_CODE_TOKEN%"
set "ANTHROPIC_MODEL=%QBRAID_CODE_MODEL%"
Expand Down
Loading