OpenAI SDK for TypeScript 7.8
Last reviewed Oct 11, 2026
Prompt Details
Prompt Composition
4prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Node.js 24101 lines · 5.3K tokens
- TypeScript 746 lines · 1.5K tokens
- OpenAI SDK for TypeScript 7.855 lines · 1.3K tokens
Total304 lines · 11.3K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 95
- 113
- 117
- 200
- 208
- 209
- 214
- 250
- 295
- 297
- 306
- 319
- 323
- 330
- 338
- 346
- 347
- 352
- 354
- 362
- 367
- 377
- 426
- 444
- 459
- 471
- 488
- 494
- 502
- 522
- 524
- 532
- 602
- 639
- 653
- 732
- 770
- 772
- 807
- 829
- 838
- 841
- 862
- 863
- 908
- 915
- 916
- 918
- 922
- 942
- 943
- 1004
- 1321
- 1333
- 1426
- 1427
Prompt Preview
Apply the Node.js 24 and TypeScript 7 prompts first. These rules cover OpenAI SDK for TypeScript 7.8 clients, Responses API, structured output, tools, streaming, realtime, files, webhooks, errors, and operations.
Clients and credentials
- Instantiate
OpenAIin trusted server code; browser use is blocked unlessdangerouslyAllowBrowser: true, which must not expose a secret key. - Load API keys from a server secret provider; separate projects, service accounts, quotas, and credentials by workload.
- Keep
baseURL, webhook secret, customfetch, proxy/agent,defaultHeaders, project, and organization in trusted configuration. - Replace the ten-minute default timeout with a workload deadline and propagate abort; automatic retries extend elapsed time.
- Avoid mutable shared clients when tenant headers or credentials differ; close custom HTTP agents at shutdown.
Responses
- Build developer instructions from trusted policy; keep user, file, retrieved, and tool output in their declared content items.
- Set
store: falsewhen provider-side state storage is unnecessary; Responses stores application state for at least 30 days by default, subject to data-control exceptions. - Leave
truncation: "disabled"(default) when silent context loss is unsafe, handling the 400 rather than blindly enabling automatic dropping. - Set
max_output_tokens(which includes reasoning tokens) andmax_tool_calls(total built-in tool calls); supplymax_tool_callsthrough a reviewed complete request-optionbodyoverride, since 7.8 HTTP create types omit it. - Tenant-scope response