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 — bug: Claude Sonnet 4.5 with thinking + ephemeral cache returns HTTP 400 · Issue #17883 · anomalyco/opencode

bug: Claude Sonnet 4.5 with thinking + ephemeral cache returns HTTP 400 #17883

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
bug: Claude Sonnet 4.5 with thinking + ephemeral cache returns HTTP 400#17883
Copy link
Assignees
rekram1-node

Description

@cyberprophet
cyberprophet
opened on Mar 17, 2026
Issue body actions

Description

When using claude-sonnet-4-5 via the Anthropic provider with extended thinking enabled, the API returns HTTP 400. The request includes thinking: { type: "enabled", budget_tokens: 31999 } and system messages with ephemeral cache_control type.

This was observed when using the model through a plugin (shop-plugin) that injects system prompts via experimental.chat.system.transform hook. The system array contains blocks with type: "ephemeral", which appears to conflict with the thinking configuration.

Error Details

service=llm providerID=anthropic modelID=claude-sonnet-4-5
error.name: AI_APICallError
error.url: https://api.anthropic.com/v1/messages
error.statusCode: 400

Request body:
  model: "claude-sonnet-4-5"
  max_tokens: 63999
  thinking: { type: "enabled", budget_tokens: 31999 }
  system: [{ type: "text", text: "..." }, { type: "ephemeral", ... }]

The same plugin works correctly with gpt-5-nano (no thinking enabled).

Steps to Reproduce

  1. Configure a plugin that uses experimental.chat.system.transform hook to inject system prompts
  2. Set model to anthropic/claude-sonnet-4-5
  3. Enable thinking (happens automatically via oh-my-opencode config or OpenCode defaults)
  4. Send any message

Expected Behavior

The API call should succeed, either by:

  • Stripping incompatible cache_control types when thinking is enabled
  • Or validating the combination before sending to the API

Environment

  • OpenCode version: 1.2.27
  • Plugin: shop-plugin (system prompt injection via hooks)
  • oh-my-opencode: 3.x
  • OS: macOS Darwin 25.3.0

Related Issues

  • Validate thinking level/variant against model capabilities before sending to API #17736 — Validate thinking level/variant against model capabilities (similar theme of pre-flight validation)

Activity

  1. github-actions
    assigned
    rekram1-node
    on Mar 17, 2026
  2. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 17, 2026
  3. cyberprophet commented on Mar 17, 2026

    @cyberprophet
    cyberprophet
    on Mar 17, 2026
    ContributorAuthor
    More actions

    Cross-reference from oh-my-openagent#2631

    After investigating the oh-my-openagent codebase, this issue is confirmed to be on the OpenCode / @ai-sdk/anthropic side, not oh-my-openagent.

    oh-my-openagent's role

    oh-my-openagent applies thinking: { type: "enabled", budgetTokens: 32000 } to all non-GPT models in its agent factories (e.g., Sisyphus, Oracle, Metis). This is a valid Anthropic API parameter for models that support extended thinking like claude-sonnet-4-5.

    The ephemeral cache_control in system messages comes from the plugin layer (experimental.chat.system.transform hook) — oh-my-openagent's own system-transform.ts is currently a no-op stub.

    Root cause

    OpenCode's provider layer should validate that the combination of thinking + system messages with cache_control: { type: "ephemeral" } is compatible before sending to the Anthropic API. The Anthropic Messages API rejects this combination with HTTP 400.

    Suggested fix

    Either:

    1. Strip cache_control from system message blocks when thinking is enabled (pre-flight sanitization)
    2. Or validate the combination and surface a clear error to the user before sending to the API

    Closing oh-my-openagent#2631 as this is an OpenCode-level concern.


    ref: code-yeongyu/oh-my-openagent#2631

  4. thdxr
    removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 6, 2026

    @github-actions
    github-actionsBot
    on Jul 6, 2026 – with GitHub Actions
    Contributor
    More actions

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

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

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

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.