AgentCircuits.Providers.Grok
0.7.103
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package AgentCircuits.Providers.Grok --version 0.7.103
NuGet\Install-Package AgentCircuits.Providers.Grok -Version 0.7.103
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AgentCircuits.Providers.Grok" Version="0.7.103" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AgentCircuits.Providers.Grok" Version="0.7.103" />
<PackageReference Include="AgentCircuits.Providers.Grok" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AgentCircuits.Providers.Grok --version 0.7.103
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AgentCircuits.Providers.Grok, 0.7.103"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AgentCircuits.Providers.Grok@0.7.103
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AgentCircuits.Providers.Grok&version=0.7.103
#tool nuget:?package=AgentCircuits.Providers.Grok&version=0.7.103
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AgentCircuits.Providers.Grok
xAI Grok provider for AgentCircuits agent framework.
Installation
dotnet add package AgentCircuits.Providers.Grok
Usage
using AgentCircuits.Providers.Grok;
// Using the static factory (API key from XAI_API_KEY environment variable)
var model = Grok.LanguageModel("grok-3");
var response = await model.GenerateAsync(new LlmRequest
{
Messages = [new Message { Role = "user", Content = [new TextContent { Text = "Hello!" }] }]
});
// With custom options
var provider = Grok.Create(new GrokProviderOptions
{
ApiKey = "your-api-key",
Region = "eu-west-1" // Optional regional endpoint
});
var model = provider.CreateLanguageModel("grok-4");
Supported Models
grok-4,grok-4-fastgrok-3,grok-3-mini- All models with
grok-prefix
Features
- Responses API support (default for generation and streaming)
- Streaming support (Responses SSE + chat fallback where compatible)
- Deferred completion polling support
- Tool calling (function + xAI built-in tools)
- Multimodal content (images)
- Regional endpoints
- Reasoning models support
- Typed API/transport exception mapping
- Configurable retries and request timeouts
Configuration
| Option | Description | Default |
|---|---|---|
ApiKey |
xAI API key | XAI_API_KEY env var |
BaseUrl |
Custom API endpoint | https://api.x.ai/v1 |
Region |
Regional endpoint (e.g., eu-west-1) |
None |
MaxRetries |
Automatic retries for retryable failures | 2 |
RequestTimeout |
Fixed per-request timeout | dynamic |
UseDynamicTimeoutFromMaxTokens |
Derive timeout from MaxTokens when RequestTimeout is unset |
true |
UseResponsesApi |
Use /responses by default for non-streaming generation |
true |
EnableChatFallback |
Fallback to chat completions when responses endpoint is unavailable | true |
DeferredPollingInterval |
Poll interval for deferred requests | 2s |
DeferredPollingTimeout |
Max wait time for deferred completion polling | unset |
Request Provider Options (ProviderOptions["grok"])
| Option | Description |
|---|---|
use_responses_api |
Override provider default and force/disable Responses API for this request |
use_chat_completions |
Force chat completions mode for this request |
deferred |
Enable deferred chat completion mode |
previous_response_id |
Continue conversation state with Responses API |
max_turns |
Set Responses API conversation turn limit |
store |
Control Responses API server-side conversation storage |
include |
Pass Responses include fields |
include_reasoning_encrypted_content |
Convenience flag to add reasoning.encrypted_content to include list |
search_parameters |
Pass Responses search parameter object |
Notes
- Responses API is the default path for both generation and streaming.
- Chat fallback is enabled by default when Responses endpoints are unavailable and the request is chat-compatible.
- Forcing chat mode with non-function tools is rejected with a typed bad-request exception.
- Server-side tools (
web_search,x_search,file_search,code_interpreter,mcp,image_generation) require Grok-4 family models on the Responses API. - Optional Responses arguments that are known to be compatibility-sensitive (
include,max_turns) are retried once without that argument if the API rejects it as unsupported.
See the main AgentCircuits repository for full documentation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- AgentCircuits.Core (>= 0.7.103)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- ModelContextProtocol (>= 0.9.0-preview.1)
- OpenAI (>= 2.8.0)
- ReverseMarkdown (>= 5.0.0)
- System.ClientModel (>= 1.9.0)
- System.Memory.Data (>= 10.0.3)
- UglyToad.PdfPig (>= 1.7.0-custom-5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.104-tool-auth-changes | 0 | 2/27/2026 |
| 0.7.103 | 32 | 2/25/2026 |
| 0.7.103-tool-auth-changes | 0 | 2/26/2026 |
| 0.7.102 | 32 | 2/24/2026 |
| 0.7.101 | 35 | 2/24/2026 |
| 0.7.100 | 38 | 2/23/2026 |
| 0.7.99 | 33 | 2/23/2026 |
| 0.7.98 | 41 | 2/23/2026 |
| 0.7.97 | 36 | 2/23/2026 |
| 0.7.96 | 38 | 2/21/2026 |
| 0.7.95 | 46 | 2/19/2026 |
| 0.7.94 | 47 | 2/18/2026 |
| 0.7.93 | 40 | 2/18/2026 |
| 0.7.92 | 42 | 2/18/2026 |
| 0.7.91 | 43 | 2/18/2026 |
| 0.7.9 | 47 | 2/18/2026 |
| 0.7.8 | 41 | 2/17/2026 |
| 0.7.7 | 43 | 2/16/2026 |
| 0.7.6 | 49 | 2/16/2026 |
| 0.7.5 | 45 | 2/16/2026 |
Loading failed