Anthropic SDK for TypeScript 0.122

Last reviewed Oct 11, 2026

Export as PDF

Prompt Details

Prompt Composition

4prompts
  1. JavaScript ES2026102 lines · 3.1K tokens
  2. Node.js 24101 lines · 5.3K tokens
  3. TypeScript 746 lines · 1.5K tokens
  4. Anthropic SDK for TypeScript 0.12262 lines · 1.5K tokens
Total311 lines · 11.5K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 73
  • 78
  • 79
  • 88
  • 89
  • 95
  • 113
  • 116
  • 117
  • 200
  • 208
  • 209
  • 214
  • 250
  • 295
  • 297
  • 319
  • 321
  • 323
  • 330
  • 338
  • 346
  • 347
  • 352
  • 354
  • 362
  • 367
  • 377
  • 426
  • 444
  • 459
  • 471
  • 488
  • 494
  • 502
  • 522
  • 524
  • 532
  • 602
  • 639
  • 653
  • 732
  • 754
  • 770
  • 807
  • 829
  • 838
  • 841
  • 862
  • 863
  • 908
  • 915
  • 916
  • 918
  • 922
  • 942
  • 943
  • 1004
  • 1321
  • 1333
  • 1427

Prompt Preview

Apply the Node.js 24 and TypeScript 7 prompts first. These rules cover Anthropic SDK for TypeScript 0.122 clients, Messages API requests, tools, streaming, files, errors, and production controls.

Clients and credentials

  • Instantiate Anthropic in trusted server code; browser use is blocked unless dangerouslyAllowBrowser: true, never with a secret key.
  • Load apiKey from a server secret provider, with separate credentials and spend limits per environment and workload. With config or credentials, disable unintended environment key/bearer defaults via apiKey: null and authToken: null.
  • Keep baseURL, custom fetch, fetchOptions, middleware, proxy/agent, and defaultHeaders in trusted configuration. Validate profile/config base_url separately: it controls credential exchanges even when baseURL is pinned.
  • Override the 10-minute timeout and enforce a separate workload deadline with an abort signal so disconnected callers don't leave costly work running.
  • Avoid mutable shared clients when tenant headers or keys differ; close custom HTTP agents at shutdown.
  • Isolate federation credentials_path files per identity and configuration: the disk cache can reuse a token without checking organization, workspace, federation rule, or token endpoint.
  • Derive anthropic-workspace-id and user_profile_id from authorized tenant context; request headers can override the user-OAuth profile workspace default and generated anthropic-user-profile-id header.

Messages

  • Build system from trusted policy; keep user, document, and tool-result blocks in