Complete documentation for all ZtoApi endpoints.
GET /v1/models # List available models
POST /v1/chat/completions # Chat completions (streaming & non-streaming)
# Supports tool calling with `tools` parameter
GET /anthropic/v1/models # List available Claude models
POST /anthropic/v1/messages # Messages (streaming & non-streaming)
POST /anthropic/v1/messages/count_tokens # Count tokens in messages
GET / # Welcome page & overview
GET /dashboard # Real-time API monitoring dashboard
GET /docs # API documentation
Base paths:
- OpenAI: http://localhost:9090/v1
- Claude: http://localhost:9090/anthropic/v1
You can control various model features using HTTP headers when making requests to the /v1/chat/completions endpoint.
X-Feature-Thinking— Enable/disable thinking mode (true/false) 💭X-Feature-Web-Search— Enable/disable web search (true/false) 🔍X-Feature-Auto-Web-Search— Enable/disable automatic web search (true/false) 🤖X-Feature-Image-Generation— Enable/disable image generation (true/false) 🎨X-Feature-Title-Generation— Enable/disable title generation (true/false) 📝X-Feature-Tags-Generation— Enable/disable tags generation (true/false) 🏷️X-Feature-MCP— Enable/disable MCP (Model Context Protocol) tools (true/false) 🛠️X-Think-Tags-Mode— Customize thinking content processing mode per request ✨
All feature headers accept the following values (case-insensitive):
"true"or"1"or"yes"— Enable the feature ✅"false"or"0"or"no"— Disable the feature ❌- If not specified, the feature uses the model's default capability
Note: Some features are model-dependent. For example, MCP tools are only available on models that support them, and web search requires a valid Z.ai API token.
All requests to the upstream Z.ai API are signed using a dual-layer HMAC-SHA256 algorithm with Base64 encoding for enhanced security. The signature is generated automatically and included in the request headers.
ZtoApi includes built-in token pool management for efficient handling of API tokens, supporting anonymous access and automatic token rotation. This ensures reliable operation without manual intervention.
For detailed configuration, see Getting Started and signature-update-guide.md.
The /v1/chat/completions endpoint supports OpenAI-compatible tool calling with the following parameters:
A list of tools the model may call. Currently, only function type is supported.
{
"type": "function",
"function": {
"name": "tool_name",
"description": "Tool description",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "Parameter description"
}
},
"required": ["param1"]
}
}
}Controls how the model uses tools:
"auto"(default) - Model decides whether to call tools"none"- Model will not call any tools{"type": "function", "function": {"name": "tool_name"}}- Force specific tool
The following tools are available by default:
Returns the current UTC time.
Parameters: None Returns: Current timestamp in ISO 8601 format
Fetches content from a URL.
Parameters:
url(string, required) - URL to fetchformat(string, optional) - Response format ("text" or "json")
Returns: Content from the URL
Calculates hash of a string.
Parameters:
text(string, required) - Text to hashalgorithm(string, optional) - Hash algorithm ("sha256" or "sha1", default: "sha256")
Returns: Hexadecimal hash value
Safely evaluates mathematical expressions.
Parameters:
expression(string, required) - Mathematical expression to evaluate
Returns: Calculated result
When the model calls tools, the response includes:
{
"choices": [{
"message": {
"role": "assistant",
"content": null,
"tool_calls": [{
"id": "call_123",
"type": "function",
"function": {
"name": "tool_name",
"arguments": "{\"param1\": \"value1\"}"
}
}]
}
}]
}After tool execution, results are sent back as:
{
"role": "tool",
"content": "Tool execution result",
"tool_call_id": "call_123"
}For detailed usage examples, see Features, Examples, and Native Tool Calling.