mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-29 21:33:54 +00:00
tfcode
ToothFairyAI's official AI coding agent - A terminal-based coding assistant with seamless integration to your ToothFairyAI workspace.
Features
- 🤖 AI-Powered Coding - Intelligent code generation, refactoring, and debugging
- 🔌 Tool Integration - Sync and use tools from your ToothFairyAI workspace
- 💻 Terminal-Based - Fast, lightweight, runs in your terminal
- 🔐 Secure - Credentials stay in ToothFairyAI, route via TF Proxy
Requirements
- Python 3.10+ - Required for ToothFairyAI integration
- Node.js 18+ - Required to run tfcode
Installation
npm install -g tfcode
The installer will:
- Check Python is installed
- Install the ToothFairyAI Python SDK automatically
Quick Start
# 1. Set your ToothFairyAI credentials
export TF_WORKSPACE_ID="your-workspace-id"
export TF_API_KEY="your-api-key"
export TF_REGION="au"
# 2. Validate your credentials
tfcode validate
# 3. Sync tools from your workspace
tfcode sync
# 4. Start coding!
tfcode
Commands
| Command | Description |
|---|---|
tfcode |
Start the AI coding assistant |
tfcode quickstart |
Show quick start guide |
tfcode validate |
Test your credentials |
tfcode sync |
Sync tools from workspace |
tfcode tools list |
List synced tools |
tfcode tools list --type mcp |
List MCP servers |
tfcode tools credentials <name> --set |
Set API key for a tool |
Regions
| Region | URL | Use Case |
|---|---|---|
dev |
api.toothfairylab.link | Development/Testing |
au |
api.toothfairyai.com | Australia (Default) |
eu |
api.eu.toothfairyai.com | Europe |
us |
api.us.toothfairyai.com | United States |
Configuration
Credentials can be set via environment variables:
export TF_WORKSPACE_ID="your-workspace-id"
export TF_API_KEY="your-api-key"
export TF_REGION="au"
Or in ~/.tfcode/tfcode.json:
{
"toothfairy": {
"workspace_id": "your-workspace-id",
"api_key": "your-api-key",
"region": "au"
}
}
Getting Your Credentials
- Log in to ToothFairyAI
- Go to Settings → API Keys
- Copy your Workspace ID and API Key
Troubleshooting
"Python 3.10+ is required but not found"
Install Python:
- macOS:
brew install python@3.12 - Windows: Download from https://python.org/downloads
- Linux:
sudo apt install python3.12
"Failed to validate: Invalid API key"
- Check your API key is correct
- Generate a new key in ToothFairyAI Settings → API Keys
"Failed to validate: Connection test failed"
Try a different region:
export TF_REGION="eu" # or us, au
Documentation
- Full Guide: https://toothfairyai.com/developers/tfcode
- API Docs: https://apidocs.toothfairyai.com
- Issues: https://github.com/ToothFairyAI/tfcode/issues
Credits
tfcode is based on opencode by anomalyco.
License
MIT