usingvarclient=newPortkeyClient(apiKey);// List all virtual keys in your Portkey account.// Virtual keys securely store provider API keys (e.g., OpenAI, Anthropic)// and can be referenced in gateway configs without exposing raw credentials.varresponse=awaitclient.VirtualKeys.GetVirtualKeysAsync(currentPage:1,pageSize:10);Console.WriteLine($"Total virtual keys: {response.Total}");foreach(varkeyinresponse.Data!){Console.WriteLine($" Key: {key.Name} (Slug: {key.Slug})");}
Configs
Manage gateway configurations for routing and load balancing.
1 2 3 4 5 6 7 8 91011121314
usingvarclient=newPortkeyClient(apiKey);// List all gateway configurations in your Portkey account.// Configs define routing rules, load balancing strategies,// fallbacks, retries, and other gateway behaviors.varresponse=awaitclient.Configs.ListConfigsAsync();Console.WriteLine($"Success: {response.Success}");Console.WriteLine($"Configs found: {response.Data!.Count}");foreach(varconfiginresponse.Data){Console.WriteLine($" Config: {config.Name} (Slug: {config.Slug})");}
Prompts
Manage prompt templates for structured LLM interactions.
1 2 3 4 5 6 7 8 9101112131415
usingvarclient=newPortkeyClient(apiKey);// List all prompt templates in your Portkey account.// Prompts are reusable templates with variables that can be// rendered and completed through the Portkey gateway.varresponse=awaitclient.Prompts.ListPromptsAsync(currentPage:1,pageSize:10);Console.WriteLine($"Total prompts: {response.Total}");foreach(varpromptinresponse.Data!){Console.WriteLine($" Prompt: {prompt.Name} (ID: {prompt.Id})");}