Docs / Recipes / .NET

// LANGUAGE SDK · .NET

.NET — OpenAI-compatible base-URL swap

Pattern A · full governance

Use the official OpenAI .NET SDK and set its Endpoint to the gateway. One option changes.

Pattern A — routed through the gateway. Your call travels through Agentics via a base-URL swap, so it is governed (routing, budgets, guardrails) inline and the Proof Ledger writes one verifiable receipt server-side. The receipt hash comes back in the x-agentics-receipt response header.

Install

shell
dotnet add package OpenAI

Swap the base URL

Point your OpenAI-compatible .NET client at https://agentics.you/api/v1 with your AGENTICS_API_KEY as the key. That is the only change.

C#
using OpenAI.Chat; using System.ClientModel; ChatClient client = new( model: "@anthropic/claude-opus-4-8", credential: new ApiKeyCredential("ak_…"), // AGENTICS_API_KEY options: new OpenAI.OpenAIClientOptions { Endpoint = new Uri("https://agentics.you/api/v1") // the only change });

Run one call → see the receipt

No OpenAI-compatible library for your stack? A raw HTTP request works and returns the same header:

cURL
curl https://agentics.you/api/v1/chat/completions -i \ -H "Authorization: Bearer ak_…" \ -H "Content-Type: application/json" \ -H "x-agentics-user: alice@acme.com" \ -d '{"model":"@anthropic/claude-opus-4-8", "messages":[{"role":"user","content":"hi"}]}' # response header: x-agentics-receipt: <receipt_hash>