@dimension-studios/ttk-proxy
CLI tool for TikTok Proxy API - A simple command-line interface to interact with the TikTok proxy service.
Installation
npm install -g @dimension-studios/ttk-proxy
Configuration
The CLI uses conf to store your API credentials. You can configure it in two ways:
1. Using Environment Variables (Recommended)
Set the following environment variables:
export TTK_FETCH_API_URL="https://your-api-url.com"
export TTK_FETCH_API_KEY="your-api-key"
export TTK_FETCH_API_SECRET="your-api-secret"
Then run the config command to save them:
ttk-proxy config
2. Using the CLI
ttk-proxy config:set apiUrl "https://your-api-url.com"
ttk-proxy config:set apiKey "your-api-key"
ttk-proxy config:set apiSecret "your-api-secret"
View Current Configuration
ttk-proxy config --show
Clear Configuration
ttk-proxy config --clear
Usage
List TikTok Proxy Tokens
List all available TikTok proxy tokens:
ttk-proxy list
Search shops (by name or slug)
Search shops your API token can access (requires GET /ttk-proxy/shops/search on the Node API):
ttk-proxy shops coffee
Call the TikTok Proxy API
Make a call to the TikTok proxy API with a JSON body:
ttk-proxy call '{"shopId":"your-shop-id","url":"https://api.tiktok.com/endpoint","method":"GET"}'
Example with more complex body:
ttk-proxy call '{
"shopId": "shop-123",
"url": "https://api.tiktok.com/v1/shops/products",
"method": "GET",
"headers": {
"Content-Type": "application/json"
},
"unofficialApi": {
"addCookieToHeaders": true,
"signUrl": true
}
}'
Base64 Support
You can also pass the JSON body as a base64-encoded string. The CLI will automatically detect and decode it:
# First encode your JSON to base64
echo -n '{"shopId":"shop-123","url":"https://api.tiktok.com/endpoint","method":"GET"}' | base64
# Then pass it directly to the CLI
ttk-proxy call "eyJzaG9wSWQiOiJzaG9wLTEyMyIsInVybCI6Imh0dHBzOi8vYXBpLnRpa3Rvay5jb20vZW5kcG9pbnQiLCJtZXRob2QiOiJHRVQifQ=="
This is useful when copying request bodies from logs or other sources where the JSON is already base64-encoded.
Output
The CLI prints plain messages to stdout, and errors to stderr.
Example output:
🚀 Calling TikTok Proxy API at https://your-api-url.com...
✅ Status: 200 OK
📦 Response:
{
"code": 0,
"data": {
"products": [...]
},
"message": "success"
}
API Reference
Commands
ttk-proxy call <body>
Call the TikTok proxy API with a JSON body.
- Arguments:
body(string): Stringified JSON body for the request (can be raw JSON or base64-encoded JSON)
ttk-proxy list
List all TikTok proxy tokens.
ttk-proxy shops <query>
Search shops authorized for your API token (GET /ttk-proxy/shops/search on your Node API). Use at least 2 characters in query.
ttk-proxy get-cookies <shopId>
Fetch cookies JSON for the given shop ID (calls POST /ttk-proxy/get-cookies).
- Options:
-i, --allow-invalid: Return the stored cookie even if no slot is marked valid
ttk-proxy config
Manage configuration.
- Options:
-s, --show: Show current configuration-c, --clear: Clear all configuration
ttk-proxy config:set <key> <value>
Set a configuration value.
- Arguments:
key(string): Configuration key (apiUrl,apiKey, orapiSecret)value(string): Configuration value
Development
Setup
# Install dependencies (repo root)
bun install
# Build the package
bun run --cwd tools/ttk-proxy build
# Run type checking
bun run --cwd tools/ttk-proxy type-check
# Development mode (watch)
bun run --cwd tools/ttk-proxy dev
Testing Locally
# After building, run the CLI from the repo root
node tools/ttk-proxy/bin/cli.js --help
License
ISC
Author
Dimension Studios
Support
For issues and questions, please open an issue on the GitHub repository.