Linux
Set up Token101 API on Linux (Ubuntu, Debian, CentOS, Arch)
Linux Setup
This guide walks you through setting up the Token101 API on Linux. The instructions cover Ubuntu/Debian, CentOS/RHEL/Fedora, and Arch Linux.
Prerequisites
- A Token101 API key — get one at token.ppthub.shop/settings/apikeys
- A Linux system with internet access
- Terminal access (SSH or local)
Step 1 — Create a Token101 Account and Get Your API Key
- Go to token.ppthub.shop and sign up for a free account
- Navigate to Settings → API Keys
- Click Create API Key, give it a name, and copy the key
Your API key is only shown once. Copy it immediately and store it somewhere safe (a password manager works well).
Step 2 — Install Node.js (optional, for JS/TS projects)
If you plan to use Node.js or TypeScript, install Node.js first.
Ubuntu / Debian
# Using NodeSource (recommended for latest LTS)
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify
node --version
npm --versionCentOS / RHEL / Fedora
# Fedora
sudo dnf install nodejs npm
# CentOS/RHEL (with NodeSource)
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejsArch Linux
sudo pacman -S nodejs npmStep 3 — Set Environment Variables
Set your Token101 API key and the base URL for your shell.
Set for current session only
export TOKEN101_API_KEY="your-token101-api-key"Set permanently — bash
echo 'export TOKEN101_API_KEY="your-token101-api-key"' >> ~/.bashrc
source ~/.bashrcSet permanently — zsh
echo 'export TOKEN101_API_KEY="your-token101-api-key"' >> ~/.zshrc
source ~/.zshrcSet system-wide (all users)
sudo tee -a /etc/environment <<EOF
TOKEN101_API_KEY="your-token101-api-key"
EOFFor server deployments, use a .env file or a secrets manager (HashiCorp Vault, AWS Secrets Manager) instead of environment variables in shell profiles.
Step 4 — Make Your First API Request
Using curl (Anthropic Messages format)
curl https://token.ppthub.shop/api/v1/messages \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN101_API_KEY" \
-d '{
"model": "gpt-5.2",
"max_tokens": 64,
"messages": [
{"role": "user", "content": "Hello! Reply with: TOKEN101_OK"}
]
}'Using curl (OpenAI Chat Completions format)
curl https://token.ppthub.shop/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN101_API_KEY" \
-d '{
"model": "gpt-5.2",
"messages": [
{"role": "user", "content": "Hello! Reply with: TOKEN101_OK"}
]
}'Using Python
Install the Anthropic SDK:
pip3 install anthropicCreate a test script:
import anthropic
import os
client = anthropic.Anthropic(
api_key=os.environ.get("TOKEN101_API_KEY"),
base_url="https://token.ppthub.shop/api",
)
message = client.messages.create(
model="gpt-5.2",
max_tokens=64,
messages=[{"role": "user", "content": "Reply with: TOKEN101_OK"}],
)
print(message.content[0].text)Run it:
python3 test_token101.pyUsing Node.js
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
apiKey: process.env.TOKEN101_API_KEY,
baseURL: 'https://token.ppthub.shop/api',
});
const response = await client.messages.create({
model: 'gpt-5.2',
max_tokens: 64,
messages: [{ role: 'user', content: 'Reply with: TOKEN101_OK' }],
});
console.log(response.content[0].text);Step 5 — Set Up a CLI Coding Tool (Optional)
Codex CLI
npm install -g @openai/codex --registry=https://registry.npmmirror.com
export OPENAI_BASE_URL="https://token.ppthub.shop/api/v1"
export OPENAI_API_KEY="$TOKEN101_API_KEY"
codex "Reply with exactly: TOKEN101_OK"Claude Code
npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
export ANTHROPIC_BASE_URL="https://token.ppthub.shop/api"
export ANTHROPIC_AUTH_TOKEN="$TOKEN101_API_KEY"
claude -p "Reply with exactly: TOKEN101_OK"Token101 accepts both ANTHROPIC_AUTH_TOKEN (sent as Authorization: Bearer ...) and ANTHROPIC_API_KEY (sent as X-Api-Key: ...). Set only one; ANTHROPIC_AUTH_TOKEN is recommended because it matches the one-command install script.
For detailed CLI setup, see Codex CLI and Claude Code.
Troubleshooting
curl: command not found
Install curl:
# Ubuntu/Debian
sudo apt-get install -y curl
# CentOS/RHEL
sudo yum install -y curl
# Arch
sudo pacman -S curlError: 401 Unauthorized
Your API key is invalid or missing. Verify it's set correctly:
echo $TOKEN101_API_KEY
# Should print your API key, not emptyPython ModuleNotFoundError: No module named 'anthropic'
pip3 install anthropic
# or in a virtual environment
python3 -m venv venv && source venv/bin/activate && pip install anthropicFirewall blocking outbound HTTPS
Token101 requires outbound HTTPS (port 443) to token.ppthub.shop. Check your firewall:
# Test connectivity
curl -s https://token.ppthub.shop/api/health
# Expected: {"status":"healthy",...}
# If blocked, check iptables/ufw
sudo ufw status
sudo iptables -L OUTPUTEnvironment variable not persisting after logout
Make sure you're editing the correct shell profile. Run echo $SHELL to find your shell, then edit the corresponding file:
| Shell | File |
|---|---|
| bash | ~/.bashrc or ~/.bash_profile |
| zsh | ~/.zshrc |
| fish | ~/.config/fish/config.fish |
Next Steps
- Supported Models — see which models are available
- Codex CLI — set up the Codex coding agent
- Claude Code — set up Claude Code
- Streaming — learn how to stream responses