Designed for fast regeneration and low-friction updates when the upstream API changes without breaking compatibility.
Modern .NET
Targets current .NET practices including nullability, trimming, NativeAOT awareness, and source-generated serialization.
Docs from examples
Examples stay in sync between the README, MkDocs site, and integration tests through the AutoSDK docs pipeline.
Ecosystem maintenance
This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.
Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.
Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.
Installation
1
dotnetaddpackagetryAGI.Inception--prerelease
Usage
1 2 3 4 5 6 7 8 91011121314
usingInception;usingvarclient=newInceptionClient(Environment.GetEnvironmentVariable("INCEPTION_API_KEY")!);varresponse=awaitclient.Chat.CreateChatCompletionAsync(newChatCompletionRequest{Model="mercury-3",Messages=[newMessage{Role=MessageRole.User,Content="Hello from Dubai!"}],ReasoningEffort=ChatCompletionRequestReasoningEffort.Instant,Realtime=true,Temperature=0.75,MaxCompletionTokens=1024,});Console.WriteLine(response.Choices[0].Message.Content?.Value1);
Named binary (noul), choice, and score questions with typed answer unions
Fim
Fill-in-the-middle code completion and SSE streaming
Edit
Predictive code edits
Models
General, chat, FIM, and edit model catalogs, including context, pricing, and capabilities
All eight operations in Inception's official OpenAPI document
are generated. The general model catalog can omit code models; query the FIM/edit catalogs too.
Microsoft.Extensions.AI
InceptionClient implements Microsoft.Extensions.AI.IChatClient directly for text,
streaming, function tools, JSON schemas, token usage, and native latency options.
See the MEAI guide.
Use the native API for Decisions, code endpoints, and diffusion frames. Diffusion
frames replace prior text rather than append; the MEAI adapter rejects this mode.
Mercury chat is text-only; the public API does not provide an audio/WebRTC transport.
Development and verification
12345
dotnettestInception.slnx--filter'TestCategory!=Live'# With INCEPTION_API_KEY exported, exercise all endpoints and both streaming APIs:
dotnettestInception.slnx--filter'TestCategory=Live'
bashsrc/libs/Inception/generate.sh
dotnettoolrunautosdk--trimsrc/libs/Inception/Inception.csproj
Live tests consume provider credits and skip if the key is missing or empty. Local
.env files are ignored and are not loaded automatically. CI accepts an optional
INCEPTION_API_KEY repository secret for live checks. The publishing workflow
always runs deterministic checks; it does not require a provider key.
Regeneration uses pinned AutoSDK and preserves the original contract in
openapi.upstream.json. The preparation step promotes the two inline Decisions
unions to named references so the generator preserves typed dictionaries. No
wire fields or endpoints are removed. The generated API contract remains governed
by Inception's terms; the SDK implementation is MIT licensed.
Dependencies
Consumer runtime code uses .NET 10 and Microsoft's Microsoft.Extensions.AI.Abstractions.
AutoSDK, MinVer, and reproducible-build tooling are development dependencies;
MSTest and AwesomeAssertions are test dependencies. No OpenAI SDK dependency is required. See dependency accounting.
CI also publishes and runs an offline NativeAOT executable covering Decisions,
MEAI tool arguments/results, usage, and SSE before the publishing workflow starts.
Chat
Inception Chat example.
123456789
usingvarclient=newInceptionClient(apiKey);// `instant` and `realtime` reduce the time to first answer text.varresponse=awaitclient.Chat.CreateChatCompletionAsync(newChatCompletionRequest{Model="mercury-3",Messages=[newMessage{Role=MessageRole.User,Content="Say hello in three words."}],ReasoningEffort=ChatCompletionRequestReasoningEffort.Instant,Realtime=true,Temperature=0.75,MaxCompletionTokens=1024,});
ChatStreaming
Inception ChatStreaming example.
1 2 3 4 5 6 7 8 9101112
usingvarclient=newInceptionClient(apiKey);varrequest=newChatCompletionRequest{Model="mercury-3",Messages=[newMessage{Role=MessageRole.User,Content="Say hello in three words."}],ReasoningEffort=ChatCompletionRequestReasoningEffort.Instant,Realtime=true,Temperature=0.75,MaxCompletionTokens=1024,};request.Stream=true;vartext=newStringBuilder();awaitforeach(varchunkinclient.Chat.CreateChatCompletionAsStreamAsync(request))foreach(varchoiceinchunk.Choices)text.Append(choice.Delta.Content);
StructuredOutput
Inception StructuredOutput example.
1 2 3 4 5 6 7 8 910111213141516171819
usingvarclient=newInceptionClient(apiKey);varrequest=newChatCompletionRequest{Model="mercury-3",Messages=[newMessage{Role=MessageRole.User,Content="Say hello in three words."}],ReasoningEffort=ChatCompletionRequestReasoningEffort.Instant,Realtime=true,Temperature=0.75,MaxCompletionTokens=1024,};request.Messages=[newMessage{Role=MessageRole.User,Content="Return the city Dubai as JSON."}];request.ResponseFormat=newResponseFormatJSONSchema{JsonSchema=newJSONSchema{Name="city_response",Strict=true,Schema=Json("""{"type":"object","properties":{"city":{"type":"string"}},"required":["city"],"additionalProperties":false}"""),},};varresponse=awaitclient.Chat.CreateChatCompletionAsync(request);usingvarresult=JsonDocument.Parse(response.Choices[0].Message.Content!.Value.Value1!);
ToolCalling
Inception ToolCalling example.
1 2 3 4 5 6 7 8 91011121314
usingvarclient=newInceptionClient(apiKey);varrequest=newChatCompletionRequest{Model="mercury-3",Messages=[newMessage{Role=MessageRole.User,Content="Say hello in three words."}],ReasoningEffort=ChatCompletionRequestReasoningEffort.Instant,Realtime=true,Temperature=0.75,MaxCompletionTokens=1024,};request.Messages=[newMessage{Role=MessageRole.User,Content="Get the weather in Dubai."}];request.Tools=[WeatherTool()];request.ToolChoice=newNamedToolChoice{Function=newToolChoiceFunction{Name="get_weather"}};varresponse=awaitclient.Chat.CreateChatCompletionAsync(request);varcall=response.Choices[0].Message.ToolCalls![0];usingvararguments=JsonDocument.Parse(call.Function.Arguments);
Typed decisions
Classify shared state with binary probability, named choices, and ordinal scores.
1 2 3 4 5 6 7 8 9101112131415161718
usingvarclient=newInceptionClient(apiKey);// Inception uses named dictionaries rather than OpenAI's question arrays.varresponse=awaitclient.Decisions.CreateDecisionAsync(newDecisionRequest{Model="mercury-decide",State="Please refund the duplicate charge on my account.",Questions=new(){["billing"]=newNoulQuestion{Instructions="Is this request about billing?"},["team"]=newChoiceQuestion{Criteria=Json("""{"billing":"Paymentsandrefunds","support":"Technicalproblems"}"""),},["urgency"]=newScoreQuestion{Instructions="How urgent is this request?",Criteria=["Can wait","Needs attention","Immediate emergency"],},},});
usingvarclient=newInceptionClient(apiKey);varresponse=awaitclient.Edit.CreateEditCompletionAsync(newEditCompletionRequest{Model="mercury-edit-2",MaxTokens=256,Messages=[newEditMessageParam{Content="<|recently_viewed_code_snippets|>\n\n<|/recently_viewed_code_snippets|>\n<|current_file_content|>\ncurrent_file_path: add.py\n<|code_to_edit|>\ndef add(a, b):\n return a - b<|cursor|>\n<|/code_to_edit|>\n<|/current_file_content|>\n<|edit_diff_history|>\n# Implement addition rather than subtraction.\n<|/edit_diff_history|>",}],});
Model catalogs
Discover models, context limits, pricing, and capabilities in every catalog.
1 2 3 4 5 6 7 8 9101112
usingvarclient=newInceptionClient(apiKey);varresponse=catalogswitch{"chat"=>awaitclient.Models.ListChatModelsAsync(),"fim"=>awaitclient.Models.ListFIMModelsAsync(),"edit"=>awaitclient.Models.ListEditModelsAsync(),_=>awaitclient.Models.ListModelsAsync(),};foreach(varmodelinresponse.Data){}// Query filtered catalogs too: the general catalog may omit Mercury Edit 2.
Microsoft.Extensions.AI
Use Mercury chat through IChatClient with native low-latency options.
1 2 3 4 5 6 7 8 91011121314151617
usingvarnative=newInceptionClient(apiKey);Meai.IChatClientclient=native;varoptions=newMeai.ChatOptions{ModelId="mercury-3",MaxOutputTokens=1024,AdditionalProperties=new(){["reasoning_effort"]="instant",["realtime"]=true},};if(streaming){vartext=newSystem.Text.StringBuilder();awaitforeach(varupdateinclient.GetStreamingResponseAsync([newMeai.ChatMessage(Meai.ChatRole.User,"Say hello in three words.")],options))text.Append(update.Text);}else{varresponse=awaitclient.GetResponseAsync([newMeai.ChatMessage(Meai.ChatRole.User,"Say hello in three words.")],options);}