Openlayer C# / .NET SDK to interact with the Openlayer platform. It supports .NET 8+ and any netstandard2.0 runtime, including .NET Framework 4.6.2+.
Install
You can install theOpenlayer package from NuGet:
Usage
The client reads your API key from theOPENLAYER_API_KEY environment variable. The methods follow the REST paths of the API reference.
OPENLAYER_BASE_URL environment variable or pass OpenlayerClientOptions.BaseUrl.
Tracing
TheOpenlayer.Tracing namespace traces your LLM app. Each request becomes a trace in your
inference pipeline, with the same columns as the Python and TypeScript SDKs. Set
OPENLAYER_API_KEY and OPENLAYER_INFERENCE_PIPELINE_ID, then:
- Wrap your functions with
Tracer.TraceAsync(name, inputs, fn). Steps nest by async flow, so concurrent requests are separate traces. - Call
.WithOpenlayerTracing()on anyMicrosoft.Extensions.AIIChatClient(OpenAI, Azure OpenAI, Ollama, …) to record each LLM call with its model, tokens and parameters. - Call
await Tracer.FlushAsync()before a short-lived process exits.
Learn more
To learn more about theOpenlayer C# / .NET SDK, check out the GitHub repository:
SDK GitHub repository
Check out the source code of the C# / .NET SDK.