GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support adaptive thinking for Claude Opus 4.6 · Issue #12485 · anomalyco/opencode

Support adaptive thinking for Claude Opus 4.6 #12485

New issue
Copy link
New issue
Copy link
Closed
Closed
Support adaptive thinking for Claude Opus 4.6#12485
Copy link
Assignees
thdxr

Description

@leeweisern
leeweisern
opened on Feb 6, 2026
Issue body actions

Anthropic has deprecated thinking.type: "enabled" with budget_tokens on Opus 4.6 and will remove it in a future release. The recommended replacement is adaptive thinking:

{
  "thinking": { "type": "adaptive" },
  "output_config": { "effort": "high" }
}

Docs: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking

Currently variants() in transform.ts uses the deprecated config for all Anthropic models, including Opus 4.6:

high: { thinking: { type: "enabled", budgetTokens: ... } },
max:  { thinking: { type: "enabled", budgetTokens: ... } },

A few things to consider:

  • Only Opus 4.6 supports adaptive — older models still need type: "enabled"
  • effort: "max" is Opus 4.6 exclusive
  • maxOutputTokens() assumes a known budgetTokens for the subtraction — adaptive doesn't have one
  • Depends on @ai-sdk/anthropic supporting type: "adaptive" upstream
Reacted by mungo, Motonari Tsuzuki, nil0ft, Chris Yang, fynn, Oscar Serna, Aiden Kim, Kush Patel, Jaakko Sirén, Stephen Haberman and 3 more

Activity

  1. github-actions
    assigned
    thdxr
    on Feb 6, 2026
  2. BouquetAntoine commented on Feb 6, 2026

    @BouquetAntoine
    BouquetAntoine
    on Feb 6, 2026
    More actions

    OpenCode currently depends on @ai-sdk/anthropic v2.x. Simply bumping the dependency to v3.x and rebuilding isn't enough — there are several breaking changes in the SDK that need to be addressed in the codebase.

    Below is a summary of every breaking change identified so far, tried different fixes in my codebase but that's a lot of work.


    1. finishReason format change

    v2.x returns a plain string:

    finishReason: "end_turn" | "tool_use" | "stop_sequence" | ...

    v3.x returns an object with unified and raw properties:

    finishReason: {
      unified: "stop" | "tool-calls" | "error" | "other" | ...
      raw: string | undefined
    }

    2. usage token counts format change

    v2.x returns flat numbers:

    usage: {
      inputTokens: 1234,
      outputTokens: 567,
      cachedInputTokens: 100,
      reasoningTokens: 200,
    }

    v3.x returns nested objects:

    usage: {
      inputTokens:    { total: 1234, noCache: 1034, cacheRead: 200 },
      outputTokens:   { total: 567, text: undefined },
      reasoningTokens: 200, // may also be an object
    }

    3. New providerOptions schema (thinking / effort)

    v2.x supports a limited thinking config:

    thinking: {
      type: "enabled" | "disabled",
      budgetTokens?: number,
    }
    // No "effort" field

    v3.x adds an adaptive mode and a new top-level effort field:

    thinking: {
      type: "adaptive" | "enabled" | "disabled",
      budgetTokens?: number, // only required when type is "enabled"
    }
    effort: "low" | "medium" | "high" | "max" // NEW

    Fix

    Update config schema validation (e.g. Zod schemas or type definitions) to accept the new "adaptive" type and the effort field.


    Problem is that we probably need to update all ai-sdk to last version for compatibility across models

  3. avarayr commented on Feb 6, 2026

    @avarayr
    avarayr
    on Feb 6, 2026
    More actions

    I was able to temporarily hack this to work until fix is in place.

    Note: this is not a long term solution, just an unblocker until this issue is fixed.

    // File: ~/.opencode/plugins/adaptiveThinking.ts
    export const adaptiveThinking: import("@opencode-ai/plugin").Plugin =
      async () => ({
          loader: async () => {
            return {
              fetch: async (url: RequestInfo | URL, init?: RequestInit) => {
                const body = init?.body
                  ? JSON.parse(init.body as string)
                  : undefined;
                  
                if (body?.thinking?.budget_tokens === -1) {
                  body.thinking = { type: "adaptive" };
                  return fetch(url, { ...init, body: JSON.stringify(body) });
                }
                return fetch(url, init);
              },
            };
          },
        },
    
        // Shim: rewrite adaptive -> enabled with sentinel budget so SDK Zod passes,
        // then the custom fetch above detects budget_tokens:-1 and patches to adaptive.
        "chat.params": async (_input, output) => {
          if (output.options?.thinking?.type === "adaptive") {
            output.options.thinking = { type: "enabled", budgetTokens: -1 };
          }
        },
      });
    // File: ~/.config/opencode/opencode.jsonc
    {
       "plugin": [
            "file:///Users/<USERNAME>/.opencode/plugin/adaptiveThinking.ts",
        ],
    	"provider": {
    	        "anthropic": { // <-- replace with your provider of choice
    	            "models": {
    	                "claude-opus-4-6@20260205": { // might need replacement based on provider
    	                    "id": "claude-opus-4-6",
    	                    "name": "Claude Opus 4.6",
    	                    "family": "claude-opus",
    	                    "attachment": true,
    	                    "reasoning": true,
    	                    "tool_call": true,
    	                    "temperature": true,
    	                    "knowledge": "2025-05",
    	                    "release_date": "2026-02-05",
    	                    "last_updated": "2026-02-05",
    	                    "modalities": {
    	                        "input": [
    	                            "text",
    	                            "image",
    	                            "pdf"
    	                        ],
    	                        "output": [
    	                            "text"
    	                        ]
    	                    },
    	                    "open_weights": false,
    	                    "cost": {
    	                        "input": 5,
    	                        "output": 25,
    	                        "cache_read": 0.5,
    	                        "cache_write": 6.25,
    	                        "context_over_200k": {
    	                            "input": 10,
    	                            "output": 37.5,
    	                            "cache_read": 1,
    	                            "cache_write": 12.5
    	                        }
    	                    },
    	                    "limit": {
    	                        "context": 200000,
    	                        "output": 128000
    	                    },
    	                    "variants": {
    	                        "adaptive": {
    	                            "thinking": {
    	                                "type": "adaptive" // special case handled by plugin
    	                            }
    	                        },
    	                        "high": {
    	                            "thinking": {
    	                                "type": "enabled",
    	                                "budgetTokens": 16000
    	                            }
    	                        },
    	                        "max": {
    	                            "thinking": {
    	                                "type": "enabled",
    	                                "budgetTokens": 128000
    	                            }
    	                        }
    	                    }
    	                }
    	            }
    	        }
    	    },
    }
  4. BouquetAntoine commented on Feb 6, 2026

    @BouquetAntoine
    BouquetAntoine
    on Feb 6, 2026
    More actions

    #12342 will fix this soon

    Reacted by Oscar Serna
  5. github-actions commented on Apr 8, 2026

    @github-actions
    github-actionsBot
    on Apr 8, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  6. github-actions
    closed this as completedon Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.