Documentation
¶
There is no documentation for this package.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
anthropic-messages
command
Command anthropic-messages hits the Anthropic-compatible /v1/messages endpoint exposed by Z.AI, using the same API key (Bearer auth, not x-api-key).
|
Command anthropic-messages hits the Anthropic-compatible /v1/messages endpoint exposed by Z.AI, using the same API key (Bearer auth, not x-api-key). |
|
async-poll
command
Command async-poll demonstrates the async image flow: submit a request, receive a task id, then block on WaitForResult until the task is terminal.
|
Command async-poll demonstrates the async image flow: submit a request, receive a task id, then block on WaitForResult until the task is terminal. |
|
audio-tts
command
Command audio-tts synthesizes speech from text via GLM TTS and writes the resulting audio bytes to a file.
|
Command audio-tts synthesizes speech from text via GLM TTS and writes the resulting audio bytes to a file. |
|
chat-streaming
command
Command chat-streaming is a minimal example of streaming a chat completion token-by-token with the Z.AI Go client, using the Go 1.23+ iterator API.
|
Command chat-streaming is a minimal example of streaming a chat completion token-by-token with the Z.AI Go client, using the Go 1.23+ iterator API. |
|
chat-tools
command
Command chat-tools demonstrates function/tool calling via RunWithTools: define one or more tools (functions the model can invoke), let the model decide which to call, dispatch the calls, and loop until the model gives a final answer.
|
Command chat-tools demonstrates function/tool calling via RunWithTools: define one or more tools (functions the model can invoke), let the model decide which to call, dispatch the calls, and loop until the model gives a final answer. |
|
embeddings-batch
command
Command embeddings-batch generates embeddings for a list of texts and prints cosine-similarity scores against a query.
|
Command embeddings-batch generates embeddings for a list of texts and prints cosine-similarity scores against a query. |
|
observability
command
Command observability demonstrates wiring an OpenTelemetry hook onto the go-z-ai client, so every API call emits a span carrying the GenAI semantic-convention attributes (gen_ai.request.model, gen_ai.system=z.ai, gen_ai.usage.input_tokens, etc.) plus metrics (duration, request count, token usage) when a MeterProvider is registered.
|
Command observability demonstrates wiring an OpenTelemetry hook onto the go-z-ai client, so every API call emits a span carrying the GenAI semantic-convention attributes (gen_ai.request.model, gen_ai.system=z.ai, gen_ai.usage.input_tokens, etc.) plus metrics (duration, request count, token usage) when a MeterProvider is registered. |
|
quickstart-chat
command
Command quickstart-chat is the minimum hello-world for the go-z-ai client: one shot, non-streaming, prints the assistant's reply.
|
Command quickstart-chat is the minimum hello-world for the go-z-ai client: one shot, non-streaming, prints the assistant's reply. |
|
quickstart-structured
command
Command quickstart-structured shows structured (JSON Schema) output: ask the model for typed data, parse the response into a Go struct.
|
Command quickstart-structured shows structured (JSON Schema) output: ask the model for typed data, parse the response into a Go struct. |
|
quickstart-vision
command
Command quickstart-vision sends an image to a vision-capable GLM model (glm-4.6v) and prints the model's description.
|
Command quickstart-vision sends an image to a vision-capable GLM model (glm-4.6v) and prints the model's description. |
|
quota-usage
command
Command quota-usage inspects the GLM Coding Plan quota and recent usage for the configured API key.
|
Command quota-usage inspects the GLM Coding Plan quota and recent usage for the configured API key. |
|
rerank-documents
command
Command rerank-documents ranks candidate documents against a query using GLM's rerank API — typically the second stage of a RAG pipeline after embedding-based retrieval (see embeddings-batch).
|
Command rerank-documents ranks candidate documents against a query using GLM's rerank API — typically the second stage of a RAG pipeline after embedding-based retrieval (see embeddings-batch). |
|
internal
|
|
|
accounts
Package accounts persists multiple named Z.AI credentials and tracks which one is active, so the CLI can switch between accounts without hand-editing .env.
|
Package accounts persists multiple named Z.AI credentials and tracks which one is active, so the CLI can switch between accounts without hand-editing .env. |
|
coding
Package coding is a Go port of Z.AI's official @z_ai/coding-helper ("chelper") CLI.
|
Package coding is a Go port of Z.AI's official @z_ai/coding-helper ("chelper") CLI. |
|
fileinput
Package fileinput resolves a user-supplied "file or URL" argument into the value the layout/OCR API expects: an http(s) URL is passed through verbatim, while a local path is read and base64-encoded.
|
Package fileinput resolves a user-supplied "file or URL" argument into the value the layout/OCR API expects: an http(s) URL is passed through verbatim, while a local path is read and base64-encoded. |
|
tui
Package tui implements the go-z-ai interactive terminal UI: a Bubble Tea v2 program with one tab per existing CLI command group, all wired to the same pkg/client, pkg/accounts, and pkg/coding services the non-interactive commands already use.
|
Package tui implements the go-z-ai interactive terminal UI: a Bubble Tea v2 program with one tab per existing CLI command group, all wired to the same pkg/client, pkg/accounts, and pkg/coding services the non-interactive commands already use. |
|
tui/accounts
Package accounts implements the TUI's Accounts tab: list, add, switch, and remove stored Z.AI account credentials via pkg/accounts.Store, the same store the "go-z-ai accounts" commands use.
|
Package accounts implements the TUI's Accounts tab: list, add, switch, and remove stored Z.AI account credentials via pkg/accounts.Store, the same store the "go-z-ai accounts" commands use. |
|
tui/chat
Package chat implements the TUI's Chat tab: a streaming conversation over pkg/client's ChatService, the same service "go-z-ai chat" uses.
|
Package chat implements the TUI's Chat tab: a streaming conversation over pkg/client's ChatService, the same service "go-z-ai chat" uses. |
|
tui/coding
Package coding implements the TUI's Coding tab: install/config status, auth, load, and unload for supported coding-agent tools (Claude Code, OpenCode, Crush, Factory Droid), backed by pkg/coding — the same package the "go-z-ai coding" commands use.
|
Package coding implements the TUI's Coding tab: install/config status, auth, load, and unload for supported coding-agent tools (Claude Code, OpenCode, Crush, Factory Droid), backed by pkg/coding — the same package the "go-z-ai coding" commands use. |
|
tui/media
Package media implements the TUI's Media tab: image generation, video generation, audio transcription, and OCR/layout parsing over pkg/client's ImagesService/VideosService/AudioService/LayoutService — the same services the "go-z-ai image/video/audio/ocr" commands use.
|
Package media implements the TUI's Media tab: image generation, video generation, audio transcription, and OCR/layout parsing over pkg/client's ImagesService/VideosService/AudioService/LayoutService — the same services the "go-z-ai image/video/audio/ocr" commands use. |
|
tui/modelpicker
Package modelpicker implements the Chat tab's model picker overlay: a filterable list of available Z.AI models, fetched on open, that lets the user switch the model the Chat tab sends to.
|
Package modelpicker implements the Chat tab's model picker overlay: a filterable list of available Z.AI models, fetched on open, that lets the user switch the model the Chat tab sends to. |
|
tui/models
Package models implements the TUI's Models tab: a browsable, enriched view of available Z.AI models, backed by the same ModelsService the "go-z-ai models" commands already use.
|
Package models implements the TUI's Models tab: a browsable, enriched view of available Z.AI models, backed by the same ModelsService the "go-z-ai models" commands already use. |
|
tui/palette
Package palette implements the TUI's Ctrl+P command palette: a fuzzy-filter overlay of app-wide actions (go to tab, refresh, toggle help, switch chat model, quit).
|
Package palette implements the TUI's Ctrl+P command palette: a fuzzy-filter overlay of app-wide actions (go to tab, refresh, toggle help, switch chat model, quit). |
|
tui/tools
Package tools implements the TUI's Tools tab: three independent request/response forms (web search, web reader, tokenizer) over pkg/client's ToolsService, the same service the "go-z-ai tools" commands use.
|
Package tools implements the TUI's Tools tab: three independent request/response forms (web search, web reader, tokenizer) over pkg/client's ToolsService, the same service the "go-z-ai tools" commands use. |
|
tui/uimsg
Package uimsg holds tea.Msg types shared between the TUI root model and every screen subpackage.
|
Package uimsg holds tea.Msg types shared between the TUI root model and every screen subpackage. |
|
tui/uistyle
Package uistyle holds the shared lipgloss style vocabulary used by the root chrome and every screen subpackage, so pill/border/toast colors stay consistent without pkg/tui's screens importing pkg/tui itself (which would create an import cycle, since pkg/tui imports every screen).
|
Package uistyle holds the shared lipgloss style vocabulary used by the root chrome and every screen subpackage, so pill/border/toast colors stay consistent without pkg/tui's screens importing pkg/tui itself (which would create an import cycle, since pkg/tui imports every screen). |
|
tui/usage
Package usage implements the TUI's Usage tab: a live quota + token/tool usage dashboard, backed by the same QuotaService/UsageService the "go-z-ai usage"/"accounts quota"/"accounts usage" commands use.
|
Package usage implements the TUI's Usage tab: a live quota + token/tool usage dashboard, backed by the same QuotaService/UsageService the "go-z-ai usage"/"accounts quota"/"accounts usage" commands use. |
|
usageview
Package usageview holds pure, presentation-only helpers for rendering usage/quota data (time windows, relative timestamps, compact counters, and a density-heatmap ramp).
|
Package usageview holds pure, presentation-only helpers for rendering usage/quota data (time windows, relative timestamps, compact counters, and a density-heatmap ramp). |
|
pkg
|
|
|
observe
Package observe provides observability hooks for the go-z-ai client.
|
Package observe provides observability hooks for the go-z-ai client. |
Click to show internal directories.
Click to hide internal directories.