tencent cloud

LLM Service TokenHub

TokenHub CLI User Guide

Unduh
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-09-16 15:30:32
Diterjemahkan oleh 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.
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 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:
Install THCLI for me by following the command below: https://gz-thcli-skills-1258344699.cos.ap-guangzhou.myqcloud.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.
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

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.
Note:
Model capabilities such as text-to-image, image-to-image, text-to-video, image-to-video, and text-to-speech are not supported by the CLI in the current version. To try or call these models, go to Model Experience or Model Square in the console. They will be available in later versions.

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

Capability
Capability Description
Core Command
Agent Natural Language Description (Example)
Query packages
View details of held Token Plan plans, available model scopes, and usage details.
Note:
Currently, you can only view Enterprise Edition Token Plan information. The Personal Edition Token Plan is not supported yet and will be available in a later version.
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?

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?

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
chat-config
API Key used for locally maintaining +chat conversations
thcli chat-config --help
plan
Enterprise package list, details, purchase, renewal, upgrade, and usage details
thcli plan --help
plan key
Create, delete, modify, and query enterprise package-specific keys
thcli plan key --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.

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan