Documentation
¶
Overview ¶
Package xai wraps xAI's (Grok) OpenAI-compatible API.
NewChat returns xAI's provider-local Chat, backed by the shared OpenAI Chat Completions protocol.
Current Grok models support text, image input, structured outputs, reasoning effort, and custom function calling through the Chat Completions surface. xAI's server-side Web Search, X Search, code execution, and collections tools belong to its Responses API surface and are not represented as Core custom functions by this adapter.
See https://docs.x.ai/ for the full API reference.
Index ¶
Constants ¶
View Source
const ( OpenAIRequestExtensionKey = "xai/openai_request" OpenAIResponseExtensionKey = "xai/openai_response" OpenAIStreamChunkExtensionKey = "xai/openai_stream_chunk" )
View Source
const ( Provider = "xAI" BaseURL = "https://api.x.ai/v1" )
View Source
const ( ModelGrok45 = "grok-4.5" ModelGrok43 = "grok-4.3" ModelGrokBuild01 = "grok-build-0.1" ModelGrok4 = "grok-4" )
See https://docs.x.ai/developers/models for the current catalog.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chat ¶ added in v0.13.0
type Chat = openai.ChatCompletions
Chat implements xAI's chat endpoint.
func NewChat ¶ added in v0.13.0
func NewChat(config ChatConfig) (*Chat, error)
Click to show internal directories.
Click to hide internal directories.