Tinker CLI wrapper and bridge
Project description
Tinker CLI
A beautiful terminal interface for the Tinker API, built with Bubble Tea.
Features
- ๐ Training Runs - View and manage your training runs
- ๐พ Checkpoints - Browse, publish/unpublish, and delete model checkpoints
- ๐ Usage Statistics - View your API usage and quotas
- โ๏ธ Settings - Configure API key with secure storage (OS keyring)
- โจ Interactive UI - Beautiful dark theme with keyboard navigation
- ๐ Secure Credential Storage - API keys stored in Windows Credential Manager / macOS Keychain / Linux Secret Service
Architecture
This CLI uses a Python bridge server to communicate with the Tinker API. The Tinker SDK uses gRPC-Web internally, so we wrap it with a FastAPI server that exposes a simple REST API for the Go CLI to consume.
โโโโโโโโโโโโโโโ REST โโโโโโโโโโโโโโโโโโโ gRPC-Web โโโโโโโโโโโโโโโ
โ Go CLI โ โโโโโโโโโโโโโโโบ โ Python Bridge โ โโโโโโโโโโโโโโโบ โ Tinker API โ
โ (Bubble Tea)โ localhost โ (FastAPI) โ โ โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
Installation
Prerequisites
- Go 1.21 or later
- Python 3.8 or later
- A Tinker API key
Build from source
git clone https://github.com/mohadese/tinker-cli.git
cd tinker-cli
go build -o tinker-cli .
Install Python dependencies
cd bridge
pip install -r requirements.txt
Configuration
Option 1: Use the Settings Menu (Recommended)
The easiest way to configure your API key is through the CLI itself:
- Run
./tinker-cli - Select Settings from the menu
- Select API Key and enter your key
- The key will be stored securely in your OS keyring:
- Windows: Credential Manager
- macOS: Keychain
- Linux: Secret Service (GNOME Keyring, KWallet, etc.)
Option 2: Environment Variable
Alternatively, set your Tinker API key as an environment variable:
# Linux/macOS
export TINKER_API_KEY="your-api-key-here"
# Windows (PowerShell)
$env:TINKER_API_KEY="your-api-key-here"
# Windows (CMD)
set TINKER_API_KEY=your-api-key-here
Note: Environment variables take precedence over stored credentials.
Usage
Step 1: Start the Bridge Server
First, start the Python bridge server in one terminal:
# Windows (PowerShell)
.\bridge\start_bridge.ps1
# Windows (CMD)
bridge\start_bridge.bat
# Linux/macOS
cd bridge && python server.py
# Or manually:
cd bridge
pip install -r requirements.txt
python server.py
The bridge server will start on http://127.0.0.1:8765 by default.
Step 2: Run the CLI
In another terminal, run the CLI:
./tinker-cli
Environment Variables
| Variable | Description | Default |
|---|---|---|
TINKER_API_KEY |
Your Tinker API key | (required) |
TINKER_BRIDGE_URL |
Custom bridge server URL | http://127.0.0.1:8765 |
TINKER_BRIDGE_PORT |
Bridge server port | 8765 |
TINKER_BRIDGE_HOST |
Bridge server host | 127.0.0.1 |
Keyboard Controls
| Key | Action |
|---|---|
โ/k |
Move up |
โ/j |
Move down |
Enter |
Select / Confirm / Edit |
r |
Refresh data |
p |
Publish/Unpublish checkpoint |
d |
Delete checkpoint / Delete API key (in Settings) |
Esc |
Go back / Cancel editing |
q |
Quit |
Screenshots
Main Menu
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ง TINKER CLI โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Status: โ Connected
๐ Training Runs
View and manage your training runs
๐พ Checkpoints
Browse and manage model checkpoints
๐ Usage Statistics
View your API usage and quotas
โ/k up โ/j down enter select q quit
Training Runs View
๐ Training Runs
Total: 5 runs
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ
โ ID โ Base Model โ LoRA โ Status โ Created โ
โโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโค
โ run-abc123 โ meta-llama/Llama-3.1-8B โ r64 โ completed โ 2024-01-15 10:30 โ
โ run-def456 โ Qwen/Qwen3-4B โ r32 โ running โ 2024-01-14 15:45 โ
โโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโ
โ/โ navigate r refresh esc back q quit
Project Structure
tinker-cli/
โโโ main.go # Entry point and main application model
โโโ bridge/ # Python bridge server
โ โโโ server.py # FastAPI server wrapping Tinker SDK
โ โโโ requirements.txt # Python dependencies
โ โโโ start_bridge.ps1 # PowerShell startup script
โ โโโ start_bridge.bat # Windows batch startup script
โโโ internal/
โ โโโ api/
โ โ โโโ client.go # REST API client (calls bridge)
โ โ โโโ types.go # API response types
โ โโโ config/
โ โ โโโ keyring.go # Secure credential storage (OS keyring)
โ โโโ ui/
โ โโโ app.go # App model
โ โโโ styles.go # Lip Gloss style definitions
โ โโโ views/
โ โโโ menu.go # Main menu component
โ โโโ runs.go # Training runs table
โ โโโ checkpoints.go # Checkpoints management
โ โโโ settings.go # Settings & API key configuration
โ โโโ usage.go # Usage statistics view
โโโ go.mod
โโโ go.sum
โโโ README.md
Tech Stack
Go CLI
- TUI Framework: Bubble Tea - Elm-inspired framework for terminal UIs
- Components: Bubbles - Tables, lists, spinners, text inputs
- Styling: Lip Gloss - CSS-like styling for terminals
- HTTP Client: Go standard library
net/http - Credential Storage: go-keyring - Cross-platform keyring access
Python Bridge
- Web Framework: FastAPI - Modern, fast web framework
- ASGI Server: Uvicorn - Lightning-fast ASGI server
- Tinker SDK: Official Python SDK for Tinker API
API Endpoints (Bridge Server)
| Feature | Endpoint | Method |
|---|---|---|
| Health Check | /health |
GET |
| List Training Runs | /training_runs |
GET |
| Get Training Run | /training_runs/{id} |
GET |
| List Run Checkpoints | /training_runs/{id}/checkpoints |
GET |
| List User Checkpoints | /users/checkpoints |
GET |
| Publish Checkpoint | /checkpoints/publish |
POST |
| Unpublish Checkpoint | /checkpoints/unpublish |
POST |
| Delete Checkpoint | /checkpoints/{id} |
DELETE |
| Get Usage Stats | /users/usage |
GET |
| Get Archive URL | /checkpoints/{run_id}/{cp_id}/archive |
GET |
Troubleshooting
"Bridge server not running" error
Make sure the Python bridge server is running before starting the CLI:
cd bridge
python server.py
"TINKER_API_KEY not set" error
Set your API key in the environment:
export TINKER_API_KEY="your-api-key-here"
"tinker SDK not installed" error
Install the Tinker SDK:
pip install tinker
API Documentation
When the bridge server is running, you can access the interactive API documentation at:
- Swagger UI: http://127.0.0.1:8765/docs
- ReDoc: http://127.0.0.1:8765/redoc
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file better_tinker-0.1.0.tar.gz.
File metadata
- Download URL: better_tinker-0.1.0.tar.gz
- Upload date:
- Size: 35.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43355a33cabb72bd83c7982ddc7eaa5b95d7cf8e5e10cb02b3bd4baa8fa7c6de
|
|
| MD5 |
84add13c4abef69b34b9a218516826b3
|
|
| BLAKE2b-256 |
948a098bd703df4a963a8e8191c07e176956e51d2281a67e59d5adc8dfe74230
|
File details
Details for the file better_tinker-0.1.0-py3-none-any.whl.
File metadata
- Download URL: better_tinker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b25c8c8ed070ff08fc105f9a1355ab6e013ed1df8dc09468dae462d504afb1d8
|
|
| MD5 |
104652212485ea2a492e0406eac9e077
|
|
| BLAKE2b-256 |
8b0837581b58e38c13a4e2fcb5fdfc8dfdca295383f2ca1dff0954fa3ca08417
|