cd /news/ai-tools/github-copilot-cli-byok-claude-opus-… · home › topics › ai-tools › article
[ARTICLE · art-168127] src=gist.github.com ↗ pub= topic=ai-tools verified=true sentiment=· neutral

GitHub Copilot CLI BYOK (Claude Opus/Haiku 5.5): mitmproxy rewrite of thinking.type=enabled -> adaptive + output_config.effort

A developer published a mitmproxy addon that rewrites GitHub Copilot CLI's legacy Anthropic thinking configuration so newer Claude models such as Opus 5.5 accept the requests. Copilot CLI with BYOK provider type "anthropic" sends thinking.type "enabled" with budget_tokens, which the newer models reject with HTTP 400; the addon converts it to thinking.type "adaptive" plus an output_config.effort level derived from the token budget or a THINKING_EFFORT environment variable. It also re-applies the last-seen effort for tool-loop follow-up requests that omit the thinking field.

key takeaway

Newer Claude models reject Copilot CLI's thinking.type "enabled" with budget_tokens as HTTP 400, so a mitmproxy addon maps budgets (1024/2048/4096/8191) to low/medium/high/xhigh effort under thinking.type "adaptive" and reuses the last effort for tool-loop follow-ups that omit thinking.

by read3 min views21 publishedOct 30, 2026

| | """mitmproxy addon: rewrite legacy Anthropic thinking config for newer models. | | | | | | Copilot CLI (BYOK, provider type "anthropic") sends | | | "thinking": {"type": "enabled", "budget_tokens": N, ...} | | | which newer models (e.g. Claude Opus 5.5) reject with HTTP 400. This rewrites it to | | | "thinking": {"type": "adaptive", ...}, "output_config": {"effort": "<level>"} | | | keeping the other thinking fields (display, block_binding). | | | | | | Copilot only sends thinking on the first request of a turn; follow-up requests | | | in the tool loop omit it and would run at the model's default effort. Those get | | | the effort last seen for the same model. | | | | | | Effort is $THINKING_EFFORT if set, otherwise derived from budget_tokens. | | | """ | | | | | | import json | | | import os | | | | | | from mitmproxy import ctx, http | | | | | | FORCED_EFFORT = os.environ.get("THINKING_EFFORT", "").strip().lower() | | | | | | last_effort: dict[str, str] = {} | | | | | | |

|  | # Copilot CLI's --reasoning-effort / effort picker sends these budgets: | 
|  | #   low=1024, medium=2048, high=4096, xhigh=8191 | 
|  | def effort_from_budget(budget: int \| None) -> str: | 

| | if FORCED_EFFORT: | | | return FORCED_EFFORT | | | if budget is None: | | | return "high" | | | if budget <= 1024: | | | return "low" | | | if budget <= 2048: | | | return "medium" | | | if budget <= 4096: | | | return "high" | | | return "xhigh" | | | | | | |

|  | def request(flow: http.HTTPFlow) -> None: | 
|  | if flow.request.method != "POST" or not flow.request.path.split("?")[0].endswith("/v1/messages"): | 

| | return | | | | | | # Copilot CLI zstd-compresses bodies; decode so we can edit plain JSON. | | | flow.request.decode(strict=False) | | | try: | | | body = json.loads(flow.request.content or b"{}") | | | except ValueError: | | | return | | | if not isinstance(body, dict) or "model" not in body: | | | return | | | |

|  | model = body["model"] | 
|  | thinking = body.get("thinking") | 
|  | output_config = body.get("output_config") or {} | 

| | |

|  | if isinstance(thinking, dict) and thinking.get("type") == "enabled": | 
|  | budget = thinking.get("budget_tokens") | 
|  | body["thinking"] = { | 
|  | **{k: v for k, v in thinking.items() if k != "budget_tokens"}, | 

| | "type": "adaptive", | | | } |

|  | output_config.setdefault("effort", effort_from_budget(budget)) | 
|  | last_effort[model] = output_config["effort"] | 
|  | note = f"budget_tokens={budget} -> adaptive" | 

| | elif thinking is None and "effort" not in output_config and (FORCED_EFFORT or model in last_effort): |

|  | output_config["effort"] = FORCED_EFFORT or last_effort[model] | 
|  | note = "no thinking (tool-loop follow-up)" | 

| | else: | | | return | | | |

|  | body["output_config"] = output_config | 
|  | flow.request.content = json.dumps(body).encode() | 

| | ctx.log.info( |

|  | f"[fix_thinking] model={model} {note}, effort={output_config['effort']} " | 
|  | f"temperature={body.get('temperature')}" | 

| | ) |

── more in #ai-tools 4 stories · sorted by recency
── more on @github copilot cli 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/github-copilot-cli-b…] indexed:0 read:3min 2026-10-30 · —