TE CLI (te-cli) is the command-line tool of the ThinkingEngine data analysis platform, for use by AI Agents and human users.
Authentication
You must authenticate before use. Authentication priority:
- Environment variable
TE_TOKEN(highest priority, suitable for CI/scripts) - Cached token (
~/.te-cli/tokens.json, valid for 20 hours) - macOS automatically extracts from Chrome (macOS only)
Authentication commands
# macOS 自动认证(从 Chrome 提取 token)
te-cli auth login
Manually set token
te-cli auth set-token
View authentication statuste-cli auth status
Log outte-cli auth logout
### 多环境支持
```bash
# 指定 host
te-cli auth login --host ta-staging.example.com
te-cli auth set-token <token> --host ta-staging.example.com
# 配置默认 host
te-cli config set defaultHost ta-staging.example.com
Global Parameters
All commands support the following global parameters:
| Parameter | Description | Default Value |
|---|---|---|
--host <host> |
TE instance address | defaultHost in the configuration or ta.thinkingdata.cn |
--format <json|table> |
Output format | json |
--jq <expr> |
jq filter expression | - |
--dry-run |
Only show the request, do not execute | false |
--yes |
Skip write operation confirmation | false |
Output format
JSON (default)
{
"ok": true,
"data": { ... }
}
Table
te-cli meta +list-events -p 1 --format table
jq filter
te-cli meta +list-events -p 1 --jq '.events[].eventName'
Error Handling
Errors are output to stderr, format:
{
"ok": false,
"error": {
"type": "auth | api | validation | config",
"message": "...",
"hint": "..."
}
}
Exit codes: success 0, error 1。
Security Constraints
risk: readcommands are executed directlyrisk: writecommands require confirmation, unless--yes- Using
--dry-runcan preview the request to be sent
Command Structure
te-cli <domain> +<command> [flags]
te-cli api <METHOD> <PATH> [--params] [--data]
Domains:meta(metadata),analysis(analysis),audience(audience),operation(operation)