Rust

xAI.

Contents

use utopia_agents::Xai;
Rust
pub struct Xai(Chat)

xAI's OpenAI-compatible chat completions, without structured output. Errors read {"code": ..., "error": "..."}.

Rust
use utopia_agents::{Adapter, Xai};

let adapter = Xai::new("test-api-key");
assert_eq!((adapter.name(), adapter.model()), ("xai", "grok-3-mini"));
assert!(!adapter.is_schema_supported());
Rust
pub const ENDPOINT: &str = "https://api.x.ai/v1/chat/completions"

The chat completions endpoint.

Rust
pub const MODEL_GROK_2_IMAGE: &str = "grok-2-image-1212"

Grok 2 Image.

Rust
pub const MODEL_GROK_3: &str = "grok-3"

Grok 3.

Rust
pub const MODEL_GROK_3_MINI: &str = "grok-3-mini"

Grok 3 Mini (the default).

Rust
pub const MODELS: &[&str] = &[MODEL_GROK_3, MODEL_GROK_3_MINI, MODEL_GROK_2_IMAGE]

Undocumented.