Skip to main content

Module zai

Module zai 

Source
Expand description

Z.AI API clients and Rig integrations.

Z.AI exposes OpenAI-compatible APIs for both its general platform and coding-focused platform, plus an Anthropic-compatible endpoint for tools like Claude Code.

§OpenAI-compatible example

use rig::client::CompletionClient;
use rig::providers::zai;

let client = zai::Client::new("YOUR_API_KEY").expect("Failed to build client");
let glm_4_6 = client.completion_model(zai::GLM_4_6);

§Anthropic-compatible example

use rig::client::CompletionClient;
use rig::providers::zai;

let client = zai::AnthropicClient::new("YOUR_API_KEY").expect("Failed to build client");
let glm_4_6 = client.completion_model(zai::GLM_4_6);

Structs§

ZAiAnthropicBuilder
ZAiAnthropicExt
ZAiBuilder
ZAiExt

Constants§

ANTHROPIC_API_BASE_URL
Anthropic-compatible base URL.
CODING_API_BASE_URL
Coding-focused OpenAI-compatible base URL.
GENERAL_API_BASE_URL
General-purpose OpenAI-compatible base URL.
GLM_4_5
glm-4.5
GLM_4_6
glm-4.6
GLM_4_5V
glm-4.5v
GLM_4_5_AIR
glm-4.5-air
GLM_4_5_AIRX
glm-4.5-airx
GLM_4_6_AIR
glm-4.6-air
GLM_4_6_X
glm-4.6-x

Type Aliases§

AnthropicClient
AnthropicClientBuilder
Client
ClientBuilder