Skip to content

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

deps: qualify latest Anthropic SDK 1.4.0 in docs (#4556)

dependabot[bot]65bcc4c313aa
diff --git a/docs/package-lock.json b/docs/package-lock.json
index 4494c08dd..85a82e8cc 100644
--- a/docs/package-lock.json
+++ b/docs/package-lock.json
@@ -27,7 +27,7 @@
},
"devDependencies": {
"@ai-sdk/openai": "^4.0.99",
- "@anthropic-ai/sdk": "^0.137.0",
+ "@anthropic-ai/sdk": "^1.4.0",
"@tailwindcss/postcss": "^4.3.3",
"@types/mdx": "^2.0.14",
"@types/node": "^26.6.5",
@@ -123,11 +123,11 @@
}
},
"node_modules/@anthropic-ai/sdk": {
- "version": "0.137.0",
- "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-0.137.0.tgz",
- "integrity": "sha512-YpEnbPz8kWF1BWthwUCnRhci7OvDLSUO8NFKoevoPkjNkK9CJeibZITgxr9vhqOP8Le61e5tNDHFTxw1dc6Png==",
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.4.0.tgz",
+ "integrity": "sha512-tyuibnhQL57kLOx5oomY4Ld7jOVOPNC5v3IiyRtR3l+Friv66tI4VbuZYF2NMel/T0WMuQMBFOMKDBUbUh8gPA==",
"dev": true,
- "license": "MIT",
+ "license": "Apache-2.0",
"dependencies": {
"@opentelemetry/api": "^1.4.1",
"json-schema-to-ts": "^3.1.1",
diff --git a/docs/package.json b/docs/package.json
index aca307c47..82e578dc6 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -31,7 +31,7 @@
},
"devDependencies": {
"@ai-sdk/openai": "^4.0.99",
- "@anthropic-ai/sdk": "^0.137.0",
+ "@anthropic-ai/sdk": "^1.4.0",
"@tailwindcss/postcss": "^4.3.3",
"@types/mdx": "^2.0.14",
"@types/node": "^26.6.5",
diff --git a/scripts/verify_docs_anthropic_sdk.mjs b/scripts/verify_docs_anthropic_sdk.mjs
new file mode 100644
index 000000000..6f793e552
--- /dev/null
+++ b/scripts/verify_docs_anthropic_sdk.mjs
@@ -0,0 +1,48 @@
+// From the repository root: npm --prefix docs ci
+// Then: node scripts/verify_docs_anthropic_sdk.mjs
+// Exercises the development SDK directly against an owned loopback server.
+import assert from 'node:assert/strict';
+import { createServer } from 'node:http';
+import { createRequire } from 'node:module';
+
+const require = createRequire(new URL('../docs/package.json', import.meta.url));
+const { Anthropic } = require('@anthropic-ai/sdk');
+const requests = [];
+const server = createServer(async (request, response) => {
+ const chunks = [];
+ for await (const chunk of request) chunks.push(chunk);
+ requests.push({ path: request.url, headers: request.headers, body: JSON.parse(Buffer.concat(chunks).toString('utf8')) });
+ response.writeHead(200, { 'content-type': 'application/json' });
+ response.end(JSON.stringify({
+ id: 'msg_loopback', type: 'message', role: 'assistant', model: 'claude-sonnet-4-6',
+ content: [{ type: 'thinking', thinking: 'Local SDK compatibility check.', signature: 'loopback-signature' }, { type: 'text', text: 'loopback-ok' }],
+ stop_reason: 'end_turn', stop_sequence: null,
+ usage: { input_tokens: 10, output_tokens: 4 },
+ }));
+});
+await new Promise((resolve, reject) => {
+ server.once('error', reject);
+ server.listen(0, '127.0.0.1', resolve);
+});
+try {
+ const client = new Anthropic({ apiKey: 'loopback-only', baseURL: `http://127.0.0.1:${server.address().port}`, maxRetries: 0, timeout: 5000 });
+ const input = {
+ model: 'claude-sonnet-4-6', max_tokens: 4096,
+ thinking: { type: 'enabled', budget_tokens: 1024 },
+ system: [{ type: 'text', text: 'Local SDK check.', cache_control: { type: 'ephemeral' } }],
+ tools: [{ name: 'lookup', description: 'Local fixture.', input_schema: { type: 'object', properties: { key: { type: 'string' } }, required: ['key'] }, cache_control: { type: 'ephemeral' } }],
+ messages: [{ role: 'user', content: [{ type: 'text', text: 'Test the local fixture.' }] }],
+ metadata: { user_id: 'docs-compatibility-check' },
+ };
+ const result = await client.messages.create(input);
+ assert.equal(requests.length, 1);
+ assert.equal(requests[0].path, '/v1/messages');
+ assert.equal(requests[0].headers['anthropic-version'], '2026-10-21');
+ assert.equal(requests[0].headers.authorization, 'Bearer loopback-only');
+ assert.deepEqual(requests[0].body, input);
+ assert.equal(result.content[0].type, 'thinking');
+ assert.equal(result.content[1].text, 'loopback-ok');
+ console.log(JSON.stringify({ passed: true, requests: 1, thinking: true, cachedSystemAndTool: true, metadata: true }));
+} finally {
+ await new Promise((resolve, reject) => server.close(error => error ? reject(error) : resolve()));
+}