Skip to main content

Enterprise-Ready

Designed for Fortune 500 needs – security, compliance, observability, and Azure integration out of the box.

Building Enterprise LLM Apps with .NET

.NET is Microsoft’s battle-tested framework trusted by Fortune 500 companies. It’s now easier than ever to build LLM apps. You get: Combined with Portkey’s enterprise features, you get everything needed for mission-critical LLM deployments. Monitor costs, ensure reliability, maintain compliance, and scale with confidence.

Portkey Features

Supported Clients

Implementation Overview

  1. Install OpenAI SDK
  2. Create Portkey client by extending OpenAI client
  3. Use the client in your application to make requests

1. Install the NuGet package

Add the OpenAI NuGet package to your .NET project:

2. Create Portkey Client Extension

The OpenAI package does not support directly modifying the base URL or passing additional headers. So, we write a simple function to extend OpenAI’s ChatClient or EmbeddingClient to create a new PortkeyClient.

3. Use the Portkey Client

After creating the extension above, you can pass any Portkey supported headers directly while creating the new client.
While we show common headers here, you can pass any Portkey-supported headers to enable features like custom metadata, fallbacks, caching, retries, and more.

4. View Your Request in Portkey Logs

This request will now be logged on Portkey:

Chat Completions Example

Save your Azure OpenAI details on Portkey to get a virtual key.

Embedding Example

Microsoft Semantic Kernel Example

We can make use of the Portkey client we created above to initialize the Semantic Kernel. (Please make use of the CreateClient method and not CreateChatClient method to create the client)

More Features

You can also use the PortkeyClient to send Async requests:

Next Steps

Need Help?

Ping the Portkey team on our Developer Forum or email us at support@portkey.ai