Skip to main content
The Corti.Sdk NuGet package is the official C# .NET SDK for the Corti API. It provides full coverage of every REST endpoint and WebSocket connection, with built-in authentication, automatic token refresh, async/await support, and typed exceptions.
Package: Corti.Sdk on NuGet | Examples: corti-examples

Prerequisites

  • .NET 8 or later (also supports .NET Framework 4.6.2+ and .NET Standard 2.0)
  • A Corti API client from the Corti Console

Installation

Initialization

The simplest way to get started is with client credentials (server-side):
C# .NET
Client credentials authentication is intended for backend / server-side applications only. Never expose your client secret in client-side code. For frontend scenarios, use bearer tokens or pass tokens from your backend.
Create a single CortiClient instance and reuse it throughout your application. The SDK handles token refresh automatically — there is no need to re-initialize for each request.

Authentication

The SDK supports six authentication methods to cover different deployment scenarios:
Client Credentials is the recommended authentication method. Your backend should handle all data access checks and never expose the service-account token or client secret to the browser. The other flows (Authorization Code, PKCE, ROPC) are primarily intended for Embedded Assistant use cases where end-user login is required.
Each method is covered in detail in the Authentication Guide.

Usage examples

Create an interaction

C# .NET
See the full request specification in the API Reference.

Real-time transcription (WebSocket)

C# .NET

Text generation

C# .NET

Error handling

The SDK throws typed exceptions you can catch and inspect:

Advanced configuration

Retries

The SDK retries failed requests with exponential backoff when the response is retryable and the attempt count is below the limit (default: 2). A response is retryable when the status code is 408, 429, or any 5xx. Override per request:
Set defaults for all requests via CortiRequestOptions on the client:

Timeouts

The default request timeout is 30 seconds. Override per request:
Or set a default timeout together with other options using CortiRequestOptions — see the example above.

Raw responses

Methods that return WithRawResponseTask<T> let you await either the parsed model or parsed data plus HTTP metadata. Call .WithRawResponse() on the task to get status code, URL, and headers alongside Data:
Paginated ListAsync helpers return a Pager and do not expose .WithRawResponse(). Use a non-paginated endpoint method that returns WithRawResponseTask<T> when you need raw HTTP metadata.

Pagination

List endpoints are paginated. The SDK returns a pager you can iterate with await foreach:

Additional headers

Additional query parameters

Wire enums

OpenAPI wire enums accept only documented values; FromCustom() is not available. WebSocket config-status type fields are strict enums — compare msg.Type to StreamConfigStatusMessageType or TranscribeConfigStatusMessageType members.

Custom HttpClient

Supply your own HttpClient for advanced networking (defaults, handlers, proxies):

Proxy / passthrough mode

For scenarios where your server proxies requests to Corti and handles auth externally, you can create a client with only an environment (no credentials):
No Authorization header is sent by default. Add your own headers per request using RequestOptions.AdditionalHeaders. See the Authentication Guide for details.

Resources


For support or questions, contact us