You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by gs...@apache.org on 2026/10/12 03:39:38 UTC

(tooling-llmao) 01/01: help: tighten the Claude Code setup and show how to keep it

This is an automated email from the ASF dual-hosted git repository.

gstein pushed a commit to branch gs/claude-doc
in repository https://gitbox.apache.org/repos/asf/tooling-llmao.git

commit 0841b02b15b498b4662be6159e8ad93c2e37c9b3
Author: Greg Stein <gs...@gmail.com>
AuthorDate: Sun Oct 11 22:38:59 2026 -0500

    help: tighten the Claude Code setup and show how to keep it
    
    The Claude Code page gave a block of exports that worked, but left a
    few gaps that only show up after a while, or on a machine that has
    used Claude Code before. This fills them. Nothing here changes the
    gateway; it is the help page only.
    
    Cap the output budget
    ---------------------
    The page set CLAUDE_CODE_MAX_CONTEXT_TOKENS to 120000 against a
    131072-token window "to leave room for the response", but nothing
    limited the response. Prompt and output share the window, and the
    gateway rejects a request whose prompt plus output budget exceeds it
    before the prompt is even counted (see the FAQ, "Why was the request
    rejected before it ran?"). Claude Code picks its own output budget for
    a model it does not recognise, and that budget can be larger than the
    11072 tokens the old setting left free, so a long session could start
    failing for no visible reason.
    
    CLAUDE_CODE_MAX_OUTPUT_TOKENS=8192 is now set alongside it, and the
    page states the rule: the two must add up to less than the window.
    120000 + 8192 = 128192, under 131072.
    
    The 8192 figure is a choice, not a measurement. Reviewers who use
    Claude Code through the gateway for long edits may want a different
    split between context and output.
    
    Check which endpoint the session is using
    -----------------------------------------
    Someone who has signed in to Claude Code before can end up with that
    login still in effect. The page now says to run /status once the
    session starts and to check that the address is
    https://llm.apache.org.
    
    Drop ANTHROPIC_SMALL_FAST_MODEL
    -------------------------------
    The loop set six model variables. ANTHROPIC_SMALL_FAST_MODEL is the
    older name for what ANTHROPIC_DEFAULT_HAIKU_MODEL now sets, and the
    loop already sets that one. Five remain.
    
    Turn off traffic that bypasses the gateway
    ------------------------------------------
    CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 is added to the block.
    Update checks, telemetry and error reports do not go through
    llm.apache.org, and people choosing the gateway partly for where their
    data goes should know they can switch those off.
    
    Show the settings.json form
    ---------------------------
    A new section, "Keeping the settings", gives the same values as an
    "env" block for ~/.claude/settings.json. That persists across shells
    and does not put ANTHROPIC_* variables in front of every other tool
    run from the same shell. The file holds the token, so the page says to
    keep it in the home directory and out of any repository.
    
    Layout
    ------
    The existing sentence about tools failing moves under its own heading,
    "What does not work". Its wording is unchanged. It is still imprecise:
    web search runs on the vendor's servers and cannot work through a
    gateway to another model, while file edits and shell commands are
    ordinary tool calls whose behaviour depends on the model and the
    gateway. Someone with a working setup should say which of those
    actually fail, and the page should then say so plainly.
    
    Not verified
    ------------
    Every variable named here exists in the Claude Code 2.1.296 binary.
    None of this was run end to end against the gateway: the output cap,
    /status showing the gateway address, and the settings.json block all
    want a check by someone with a key.
    
    Co-authored-by: Claude Opus 5.5 <no...@anthropic.com>
---
 docs/help/claude-code.md | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/docs/help/claude-code.md b/docs/help/claude-code.md
index a075e15..83ced59 100644
--- a/docs/help/claude-code.md
+++ b/docs/help/claude-code.md
@@ -7,9 +7,11 @@ export ANTHROPIC_BASE_URL=https://llm.apache.org
 export ANTHROPIC_AUTH_TOKEN="$LLMAO_KEY"
 export CLAUDE_CODE_EFFORT_LEVEL=medium
 export CLAUDE_CODE_MAX_CONTEXT_TOKENS=120000
+export CLAUDE_CODE_MAX_OUTPUT_TOKENS=8192
+export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
 export MODEL=gemma4-26b
 for v in ANTHROPIC_MODEL ANTHROPIC_DEFAULT_OPUS_MODEL ANTHROPIC_DEFAULT_SONNET_MODEL \
-         ANTHROPIC_DEFAULT_HAIKU_MODEL ANTHROPIC_SMALL_FAST_MODEL CLAUDE_CODE_SUBAGENT_MODEL; do
+         ANTHROPIC_DEFAULT_HAIKU_MODEL CLAUDE_CODE_SUBAGENT_MODEL; do
   export "$v=$MODEL"
 done
 claude
@@ -17,10 +19,42 @@ claude
 
 Set `ANTHROPIC_AUTH_TOKEN`, not `ANTHROPIC_API_KEY`. The base URL has no `/v1`. Every role uses the same model, because the gateway answers only for the models it serves.
 
-`CLAUDE_CODE_MAX_CONTEXT_TOKENS` matters. Claude Code assumes a 200k window for a model it does not recognise and compacts too late. Set it below the model's window. 120000 against 131072 leaves room for the response. The [Models page](/models) lists each window.
+Once it starts, `/status` shows the address and the credentials the session is using. Check it if you have signed in to Claude Code before: the address should be `https://llm.apache.org`.
+
+`CLAUDE_CODE_MAX_CONTEXT_TOKENS` matters. Claude Code assumes a 200k window for a model it does not recognise and compacts too late. Set it below the model's window. The [Models page](/models) lists each window.
+
+`CLAUDE_CODE_MAX_OUTPUT_TOKENS` goes with it. Prompt and response share the window, and a request that asks for more than is left is rejected before it runs. The two settings must add up to less than the window: 120000 and 8192 against 131072.
 
 Prefer `gemma4-26b`. A model that reasons before it emits can sit silent long enough that Claude Code abandons the stream and retries. `gemma4-26b` starts emitting immediately.
 
 `CLAUDE_CODE_EFFORT_LEVEL=medium` is for models that refuse the default `high`. `qwen3.8-27b` accepts `low`, `medium`, and `xhigh`. `gemma4-26b` accepts the default, so the effort line is optional there. `claude --effort medium` sets the same value for one run.
 
+`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` turns off update checks, telemetry, and error reports, which do not go through the gateway.
+
+## Keeping the settings
+
+To avoid exporting these in every shell, put them in the `env` block of `~/.claude/settings.json`. Claude Code applies them each time it starts, and other tools in your shell do not see them.
+
+```json
+{
+  "env": {
+    "ANTHROPIC_BASE_URL": "https://llm.apache.org",
+    "ANTHROPIC_AUTH_TOKEN": "<your personal access token>",
+    "ANTHROPIC_MODEL": "gemma4-26b",
+    "ANTHROPIC_DEFAULT_OPUS_MODEL": "gemma4-26b",
+    "ANTHROPIC_DEFAULT_SONNET_MODEL": "gemma4-26b",
+    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemma4-26b",
+    "CLAUDE_CODE_SUBAGENT_MODEL": "gemma4-26b",
+    "CLAUDE_CODE_EFFORT_LEVEL": "medium",
+    "CLAUDE_CODE_MAX_CONTEXT_TOKENS": "120000",
+    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "8192",
+    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
+  }
+}
+```
+
+That file holds your token, so keep it in your home directory and out of any repository.
+
+## What does not work
+
 Tools such as web search fail in Claude Code today. Conversation works.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org