Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

bump the Claude Code client version claimed by Anthropic subscription requests (opus-5.5 gate) + ban-risk warning (#2645)

kt703cc4547a29
diff --git a/packages/ai/.changes/anthropic-subscription-honest-identity.md b/packages/ai/.changes/anthropic-subscription-honest-identity.md
new file mode 100644
index 0000000000..1b3c966628
--- /dev/null
+++ b/packages/ai/.changes/anthropic-subscription-honest-identity.md
@@ -0,0 +1 @@
+- Bumped the Claude Code client version claimed by Anthropic subscription (OAuth) requests from 2.1.261 to 2.1.281: the API gates newer models on the claimed client version and rejects claude-opus-5.5 (and other gated models) with a 400 for anything below 2.280.
diff --git a/packages/ai/src/providers/anthropic.ts b/packages/ai/src/providers/anthropic.ts
index 270a43da18..d42d791543 100644
--- a/packages/ai/src/providers/anthropic.ts
+++ b/packages/ai/src/providers/anthropic.ts
@@ -82,7 +82,9 @@ function getCacheControl(
}
// Stealth mode: Mimic Claude Code's tool naming exactly
-const claudeCodeVersion = "2.1.261";
+// The API gates newer models on the claimed client version (e.g. claude-opus-5.5
+// requires >= 2.280), so keep this at or above the latest released Claude Code.
+const claudeCodeVersion = "2.1.281";
// Claude Code 2.x tool names (canonical casing)
// Source: https://cchistory.mariozechner.at/data/prompts-2.1.11.md
diff --git a/packages/ai/test/anthropic-thinking-disable.test.ts b/packages/ai/test/anthropic-thinking-disable.test.ts
index b1050edda7..4738136ec5 100644
--- a/packages/ai/test/anthropic-thinking-disable.test.ts
+++ b/packages/ai/test/anthropic-thinking-disable.test.ts
@@ -268,6 +268,12 @@ describe("Anthropic request wire contract", () => {
},
);
expect(toolsOf(oauth.body).map((entry) => entry.name)).toEqual(["TodoWrite", "find", "my_custom_tool"]);
+ // Subscription requests claim the Claude Code client identity, and the
+ // claimed version must stay at or above what the API's model gates require
+ // (opus-5.5 family rejects anything below 2.280).
+ expect(oauth.headers["user-agent"]).toMatch(/^claude-cli\//);
+ expect(oauth.headers["x-app"]).toBe("cli");
+ expect((oauth.headers["anthropic-beta"] as string) ?? "").toContain("claude-code-20250219");
const apiKey = await captureAnthropicRequest(
getFixtureModel<"anthropic-messages">("anthropic", "claude-sonnet-4-6")!,
diff --git a/packages/coding-agent/.changes/anthropic-subscription-ban-risk-warning.md b/packages/coding-agent/.changes/anthropic-subscription-ban-risk-warning.md
new file mode 100644
index 0000000000..1797d120eb
--- /dev/null
+++ b/packages/coding-agent/.changes/anthropic-subscription-ban-risk-warning.md
@@ -0,0 +1 @@
+- The Anthropic subscription-auth warning now names the risk: subscription requests identify as Claude Code, which may violate Anthropic's terms and can get the account restricted or banned; an API key avoids the risk.
diff --git a/packages/coding-agent/examples/extensions/custom-provider-anthropic/index.ts b/packages/coding-agent/examples/extensions/custom-provider-anthropic/index.ts
index 69267f4006..4213916caf 100644
--- a/packages/coding-agent/examples/extensions/custom-provider-anthropic/index.ts
+++ b/packages/coding-agent/examples/extensions/custom-provider-anthropic/index.ts
@@ -375,7 +375,7 @@ function streamCustomAnthropic(
accept: "application/json",
"anthropic-dangerous-direct-browser-access": "true",
"anthropic-beta": `claude-code-20250219,oauth-2025-04-20,${betaFeatures.join(",")}`,
- "user-agent": "claude-cli/2.1.2 (external, cli)",
+ "user-agent": "claude-cli/2.1.281 (external, cli)",
"x-app": "cli",
};
} else {
diff --git a/packages/coding-agent/src/modes/interactive/auth-flows.ts b/packages/coding-agent/src/modes/interactive/auth-flows.ts
index c3863d866a..1e2717435d 100644
--- a/packages/coding-agent/src/modes/interactive/auth-flows.ts
+++ b/packages/coding-agent/src/modes/interactive/auth-flows.ts
@@ -47,7 +47,7 @@ export type AuthenticationResult =
export const BEDROCK_PROVIDER_ID = "amazon-bedrock";
export const ANTHROPIC_SUBSCRIPTION_AUTH_WARNING =
- "Anthropic subscription auth is active. Third-party harness usage draws from extra usage and is billed per token, not your Claude plan limits. Manage extra usage at https://claude.ai/settings/usage.";
+ "Anthropic subscription auth is active. Usage draws from your plan limits, but Prime Agent identifies as Claude Code and this may violate Anthropic's terms — your account can be restricted or banned. An Anthropic API key avoids the risk. Manage usage at https://claude.ai/settings/usage.";
function isAnthropicSubscriptionAuthKey(apiKey: string | undefined): boolean {
return typeof apiKey === "string" && apiKey.startsWith("sk-ant-oat");