tencent cloud

문서大模型服务平台 TokenHub

TokenHub CLI User Guide

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-11-12 19:45:42
AI 번역 및 품질 검수 완료

Overview

TokenHub CLI (a command-line tool with the command name thcli / th) is a command-line access method provided by TokenHub, a large model service platform, for terminal developers and AI Agents.
The CLI command entry is unified as thcli <command> [subcommand] [--parameter]. You can add -h or --help at any level to view the complete parameter description.
Note:
You can perform operations such as login authentication, model query, inference calls, plan quota viewing, and usage statistics directly in the terminal, without switching to the console page.
You can also inject TokenHub capabilities into mainstream AI Agents with one click, enabling Agents to understand and invoke TokenHub capabilities through natural language.
After installation, two equivalent commands are provided: thcli and its short alias th. The examples in this document use thcli consistently. Replacing it with th produces exactly the same result, for example, th models list = thcli models list.

Preparation

Before using the TokenHub CLI, you need to:
Log in to the Tencent Cloud Large Model Service Platform TokenHub console and activate the Large Model Service Platform TokenHub by following the on-screen instructions.
Node.js version 18 or later is installed on this machine (for running the CLI).

Installation and Login

Manual Installation
AI Agent Installation
1. Enter the installation command in the terminal.
npm i -g tencent-tokenhub-cli

# (Optional) Inject TokenHub capabilities into a local Agent as a Skill with one click, enabling the Agent to invoke TokenHub's read-only capabilities through natural language.
thcli +connect
2. Log in and authenticate.
Attention:
First, run thcli site use --name intl to switch to the international site (this setting takes effect permanently and only needs to be configured once. Accounts and keys are not shared between the China site and the international site).
Method 1: OAuth quick login (recommended) —— After you log in to your Tencent Cloud account, a data plane API Key (named thcli-key) is automatically generated and saved locally for subsequent inference calls, eliminating the need for manual configuration.
thcli auth login
Method 2: In browserless environments (remote development machines, CI, containers), use --browser no and paste the credential string from the webpage back into the terminal as prompted.
thcli auth login --browser no
Method 3: Manually enter the key. If you already have a Tencent Cloud International permanent key (SecretId/SecretKey), you can enter it directly.
thcli auth set --secret-id <SecretId> --secret-key <SecretKey>
3. Verify the login status.
thcli auth status
Copy the following Prompt and send it to the Agent to automatically complete installation and login:
Please read the following document to help me install TokenHub CLI: https://tokenhub-cli.tencentmaas.com/tokenhub-cli-skills/install.md
Note:
To prevent AI Agents from mistakenly triggering operations such as deletion, creation, or modification due to misinterpretation during autonomous task execution, which could cause unpredictable impacts on production environments, the Skill injected into the Agent in the current version only encapsulates read-only commands:
Supported: checking usage, selecting models, viewing plan quotas, and checking service status.
Not supported: directly triggering write operations such as creation, modification, deletion, and purchase through natural language.

Features

1. Authentication and Identity

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Sign-in and Credentials
Log in to a Tencent Cloud account (OAuth; after login, a data plane API Key named thcli-Key is automatically generated and saved for inference calls) or manually enter the credentials.
Attention:
First, run thcli site use --name intl to switch to the international site.
thcli auth login / set
Check the account, site, and credential validity period I am currently logged in with.
View the source and validity period of the current credential.
thcli auth status
Log out.
thcli auth logout
API Key Management
View the Key list, details, and plaintext.
thcli key list / get / reveal
List all API keys under my account, including their names and access scopes.
Check how much of the quota for this Key has been used.
Create a Key (with configurable accessible models, services, and Token quota); modify remarks and IP address allowlist.
thcli key create / update / quota
Enable, disable, and delete; adjust quota limits.
thcli key enable / disable / delete
Multiple Accounts and Multiple Sites
View / create / switch the default Profile (identity isolation for multiple accounts on the same site).
thcli profile list / current / use / create
Check which Profile and site I am currently using.
View / switch the default site (cn domestic site / intl international site).
thcli site list / current / use

2. Model Discovery

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Model list and details
View all models available on the platform, including language, vision, multimodal, speech, and vector models.
You can filter by type, vendor, and Tag.
View the specifications and billing information of a single model, such as its context window, maximum output, and rate limits.
thcli models list
thcli models search
thcli models get
What models are available, and what are their capabilities and vendors?
What are the context window and maximum output length of deepseek-v3?
Price comparison
Compare the input, output, and cache unit prices of multiple models horizontally.
thcli models compare
thcli models pricing
Compare the prices of deepseek-v3 and glm-5v-turbo for me.

3. Model Invocation

Language Model Related

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Dialogue
Initiate inference calls to language models, supporting multi-turn conversations, image/document multimodal input, internet search, deep thinking, and streaming output.
thcli +chat --model <Model Id> "Hello"
Note:
+chat is billed by token and prioritizes the model's free quota. When the free quota is exhausted, you must enable pay-as-you-go billing through endpoint postpaid on to continue making calls.
Use the deepseek-v4-flash model to check the error in this screenshot and explain it.
Prove the Pythagorean theorem and derive it step by step for me.

Vision Models (Image, Video, and 3D Generation) and Speech Models

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Image generation
Text-to-image, image-to-image, multi-turn session editing, image sets, transparent backgrounds, and layer splitting. Covers the Hunyuan Hy, WAND-Vega, Vidu, Kling, and other model series.
thcli +gen <API ID (API path)> --model <Model ID> --prompt "<image description>" [--images <reference image>]
Example:
Text-to-image: thcli +gen wand/hunyuan-image/v35-generation --model hy-image-v3.5-preview --messages '[{"role":"user","content":[{"type":"text","text":"An orange cat lying on the windowsill"}]}]' --size 1024x1024 --output ./out
Image-to-image: thcli +gen wand/hunyuan-image/v35-generation --model hy-image-v3.5-preview --messages '[{"role":"user","content":[{"type":"text","text":"Change to watercolor style"},{"type":"image_url","image_url":{"url":"./ref.png"}}]}]' --output ./out
Note:
+gen is billed by token and prioritizes the model's free quota. If the model does not include a free quota or the free quota is exhausted, you must enable pay-as-you-go billing through endpoint postpaid on to continue making calls.
Use hy-image-v3.5-preview to generate a cyberpunk-style city night scene and save it to ./out.

Use hy-image-v3 to reference this image and generate a watercolor-style version.
Video generation
Text-to-video, image-to-video, first-and-last-frame video generation, reference-based video generation, and motion control. Covers the Hunyuan Hy, Kling, Vidu, PixVerse, MiniMax, WAND-Vega, and other model series.
thcli +gen <API ID (API path)> --model <Model ID> --prompt "<video description>" [--image <first frame image>] [--no-wait]

Example:
Text-to-video: thcli +gen wand/hunyuan-video/generation --model hy-video-v1.5 --prompt "Seaside sunset" --aspect-ratio 16:9 --output ./out
Image-to-video: thcli +gen wand/hunyuan-video/generation --model hy-video-v1.5 --image ./cat.jpg --prompt "The cat turns its head" --no-wait
Note:
+gen is billed by token and prioritizes the model's free quota. If the model does not include a free quota or the free quota is exhausted, you must enable pay-as-you-go billing through endpoint postpaid on to continue making calls.
Use hy-video-v1.5 to generate a 16:9 seaside sunset video.

Use hy-video-v1.5 to generate a video of a cat turning its head, with this image as the first frame.
3D and world models
Text-to-3D and image-to-3D model generation.
Generate 360° panoramas and scenes of 3D worlds.
thcli +gen <API ID (API path)> --model <Model ID> --prompt "<scene or object description>" [--<reference image field> <reference image>]

Example:
360° panorama: thcli +gen wand/hunyuan-image/world2-panorama --model hy-world2-panorama --prompt "A Jiangnan ancient town in the early morning" --output ./out
Note:
+gen is billed by token and prioritizes the model's free quota. If the model does not include a free quota or the free quota is exhausted, you must enable pay-as-you-go billing through endpoint postpaid on to continue making calls.
Use hy-world2-panorama to generate a 360° panorama of a Jiangnan ancient town in the early morning.
Speech generation and recognition
TTS, voice cloning, and voice design.
ASR (outputting text and subtitles), AI dubbing, and music generation.
ASR: thcli +gen <API ID (API path)> --model <model ID> --data <local audio> or --input-url <audio URL>
TTS: thcli +gen <API ID (API path)> --model <model ID> --text "<text>" --voice-setting '<voice configuration>'.

Example:
ASR: thcli +gen wand/asrproxy/sync_transcribe --model hy-asr-3.0-preview --data ./speech.wav --output ./out
TTS: thcli +gen wand/minimax-tts/sync_tts --model minimax-speech-2.8-hd --text "Hello" --voice-setting '{"voice_id":"male-qn-qingse"}' --output ./out
Note:
+gen is billed by token and prioritizes the model's free quota. If the model does not include a free quota or the free quota is exhausted, you must enable pay-as-you-go billing through endpoint postpaid on to continue making calls.
Use hy-asr-3.0-preview to recognize the content of this recording and output SRT subtitles.

Use minimax-speech-2.8-hd to synthesize this copy into speech, with voice ID xxx.
Generation APIs and task management
View all generation APIs, their invocation methods (synchronous/asynchronous), and the complete parameters of each API.
Query the status of asynchronous tasks and download results; list tasks submitted from this machine.
View generation API parameters: thcli +gen apis [API ID (API path)].
Query asynchronous tasks: thcli +gen status <API ID (API path)> <task ID> [--wait] [--output <directory>].
List local generation tasks: thcli +gen tasks.

Example:
View Hunyuan image generation model API parameters: thcli +gen apis wand/hunyuan-image/v35-generation
Query and download task results: thcli +gen status wand/hunyuan-video/generation <task ID> --wait --output ./out
Note:
The above query commands do not incur any fees.
What Hunyuan image generation models are available in TokenHub, and which ones are synchronous?
Is the hy-video-v1.5 video task I just submitted complete? If so, download it to ./out.
More Information:
An API ID (API path) is the request path of a generation API without the /v1 prefix. For example, the request path /v1/wand/hunyuan-image/v35-generation corresponds to the API ID wand/hunyuan-image/v35-generation. You can run thcli +gen models to view all API IDs and their corresponding models.
Synchronous APIs return results immediately after submission. Asynchronous APIs wait for completion by default. If you add --no-wait, the API only submits the request and returns a task ID, which you can then query with +gen status.
For fields that support Base64, you can directly pass a local file path, and the CLI will automatically encode it. For fields that only support public network URLs, you must pass a URL.
Add --output <directory> to download the results locally. The result link expires after about 12 hours, so save it promptly.

4. Inference Service and Deployment

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Service query
View the service (endpoint) list and details, including running status, billing method, rate limit threshold, and free quota usage.
thcli endpoint list
thcli endpoint get
"What services do I have, and what are their respective states"
What is the current rate limit for this service?
Deploy / Modify / Delete
Create a custom service (set the billing method and RPM / TPM rate limits).
Modify the configuration; delete it.
Enable/disable pay-as-you-go billing for a service.
thcli deploy
thcli endpoint update / delete
thcli endpoint postpaid on / off
Note:
The endpoint postpaid on and deploy operations will incur charges, and a second confirmation is required by default.
None
Attention:
Deploying, modifying, and deleting access points are write operations and currently cannot be triggered directly by natural language.

5. Plans and Quotas

Type
Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Enterprise plan
Query packages
View details, available model scopes, and usage details of held Enterprise Token Plan packages.
thcli plan list
thcli plan info / models / detail
What enterprise plans do I have, and how much quota is left in each?
Which models are available under this plan?
I want to view the usage details of this plan.
Purchase / Renew / Upgrade
Purchase Enterprise plans (Pro/Lite), renew, and upgrade plan quotas.
thcli plan buy
thcli plan renew / upgrade
Note:
plan buy/renew/upgrade will incur charges and require a second confirmation by default.
None
Attention:
Purchasing, renewing, and upgrading are write operations that incur charges and currently cannot be triggered directly by natural language.
Package-specific Key
View, create, modify, reset, and delete dedicated API keys for Enterprise plans (independent from platform keys, with separately calculated quotas).
thcli plan key list / get
thcli plan key create / update / rotate / delete
Which dedicated keys are available under this plan?
Personal Edition plan
Query packages
View details, available model scopes, and usage details of held Personal Edition Token Plan packages.
thcli plan personal list
thcli plan personal info / models / usage --series <common / hy>
What Personal Edition plans do I have, and how much quota is left in each?
Which models are available under this plan?
I want to view the usage details of this plan.
Personal Edition shared Key
View / generate / display plaintext / reset / delete Personal Edition shared keys (shared between General and Hy, with separately calculated quotas).
thcli plan personal key show / create / reveal / rotate / delete
What is the status of my Personal Edition shared Key? Generate a Personal Edition shared Key.

6. Observability and Diagnostics

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Usage statistics
View Token consumption rankings and trends by model, endpoint, and API Key, with aggregation by hour, day, and other granularities. Export usage details as CSV for reconciliation.
thcli usage rank / trend / export
How many tokens were used today, and which model consumed the most?
View the tpm trend of the xx service over the last 7 days.
Export the usage data of the last 7 days by Key to a CSV file.
Model monitoring
View monitoring data by language, vision, and speech model type.
You can view metrics such as RPM, TTFT, TPOT, and error rate by model, access point, and API Key, with aggregation supported by hour or day.
thcli monitor text / vision / audio
thcli monitor text --model <name>
Check whether the hy3 model has any call failure records in the last 7 days.
Diagnosis and troubleshooting
Full-path health check (credentials, regions, permissions)
Diagnose Key, Service, Model, and Plan, and view their status and availability.
Error code translation.
thcli doctor all
thcli doctor key / endpoint / model / plan
thcli doctor error
Why did the call fail? Check which step went wrong.
What does this error code mean?
Before generating images with hy-image-v3.5-preview, check whether it can be called successfully.
What does Kling video generation returning 1201 mean, and how can it be fixed?

7. Agent Integration and Access

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
One-click Skill injection
Inject the read-only capabilities of TokenHub into the local Agent as a Skill, enabling the Agent to understand and call TokenHub using natural language.
thcli +connect
thcli +connect uninstall
thcli +connect status
Read the <installation document link> and help me integrate TokenHub CLI into my Claude Code.
Check which TokenHub-related Skills are already installed on this machine.

8. Skill-Specific Capabilities

Capability
Capability Description
Agent Natural Language Description (Example)
Document search
Based on the TokenHub official documentation, quickly understand and help users search for the information they need.
What are the call parameters and steps for hy3?
Where can I view my billing details? Provide a link.
Explain to me what inference services are.
According to the official documentation, help me integrate the hy3 model into WorkBuddy.

Viewing Full Command Parameters

To view the complete parameters actually supported by each command or subcommand, use -h or --help. This applies at any level, for example, thcli --help, thcli plan --help, or thcli plan key create --help.
The following table lists how to view the complete parameters for each core command group:
Command Group
Description
View Full Parameters
auth
Sign in, sign out, manually enter keys, and view status
thcli auth --help
key
API key list, details, create, delete, modify, enable, disable, and plaintext
thcli key --help
models
Model list, details, price comparison, and search recommendations
thcli models --help
endpoint / deploy
Endpoint list, details, modify, delete; create endpoint
thcli endpoint --help
thcli deploy --help
+chat
Inference call
thcli +chat --help
+gen
Generate images, videos, 3D content, and audio; query asynchronous tasks
thcli +gen --help
chat-config
Locally maintain the API Key used for +chat conversations and +gen generation
thcli chat-config --help
plan
Enterprise package list, details, purchase, renewal, upgrade, and usage details
thcli plan --help
plan personal
Personal package list, details, purchase, renewal, upgrade, and usage details
thcli plan personal --help
usage
Usage ranking and export to CSV
thcli usage --help
monitor
RPM, TTFT, TPOT, error rate, and more
thcli monitor --help
doctor
Full-path health check and output repair actions
thcli doctor --help
profile
Multi-account Profile management
thcli profile --help
site
Site (cn / intl) switching
thcli site --help
lang
Interface language (zh / en) switching
thcli lang --help
+connect
One-click Agent Skills injection
thcli +connect --help

References

For advanced information about resource isolation rules for sites and regions, the local file structure (~/.thcli/), and Activity Log, see the open-source repository.





도움말 및 지원

문제 해결에 도움이 되었나요?

피드백