OpenAI SDK for .NET 2.13.0
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- C# 14106 lines · 4.4K tokens
- OpenAI SDK for .NET 2.13.073 lines · 3.3K tokens
Total179 lines · 7.7K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 89
- 94
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 257
- 295
- 306
- 319
- 323
- 327
- 338
- 347
- 362
- 367
- 378
- 426
- 502
- 532
- 611
- 639
- 674
- 759
- 770
- 772
- 775
- 798
- 807
- 841
- 862
- 863
- 915
- 916
- 918
- 1333
- 1395
- 1426
- 1427
Prompt Preview
Apply the C# 14 prompt first. These rules cover the official OpenAI NuGet package 2.13.0 in C# 14/.NET 10 applications. Its additional .NET 8 and .NET Standard 2.0 assets establish compatibility, not the support lifecycle of every compatible runtime.
Clients, credentials, and transport
- Authenticate and authorize application callers before invoking the SDK. Use protected project or service-account credentials on the server; an OpenAI API key does not establish the caller's application permissions.
- Reuse thread-safe clients for each fixed credential, endpoint, and project configuration. Keep request options, message histories, and resource-ID mappings isolated per caller; do not rotate a shared
ApiKeyCredentialto impersonate different tenants. - Set
Endpoint,OrganizationId,ProjectId, authentication policies, and transports only from trusted configuration. UseResponsesClientOptionsfor directResponsesClientconstruction andOpenAIClientOptionsforOpenAIClientandChatClient; restrict credential-bearing traffic to approved HTTPS destinations, including custom proxies and redirects. - Configure finite
NetworkTimeoutvalues and pass a cancellation token with an overall deadline to SDK operations.NetworkTimeoutbounds individual network operations, not the complete retry, polling, or tool-execution workflow. - Budget for up to three additional attempts on HTTP 408, 429, 500, 502, 503, and 504 by default. Configure
RetryPolicywithClientRetryPolicy, using zero retries when replay is unsafe; bound any outer retry loop and reconcile