Skip to main content

Tinker CLI wrapper and bridge

Project description

Tinker CLI

A beautiful terminal interface for the Tinker API, built with Bubble Tea.

Go Python License

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:

  1. Run ./tinker-cli
  2. Select Settings from the menu
  3. Select API Key and enter your key
  4. 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:

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

better_tinker-0.1.3.tar.gz (35.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

better_tinker-0.1.3-py3-none-any.whl (23.4 MB view details)

Uploaded Python 3

File details

Details for the file better_tinker-0.1.3.tar.gz.

File metadata

  • Download URL: better_tinker-0.1.3.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

Hashes for better_tinker-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c4d1bf50923469c5933f556f339b05834a82578e4fd3f45ac94325b859642862
MD5 034adafaf04a6b488d1dca36833eb6ab
BLAKE2b-256 69f2dabcfab6571d305ed7c379956d0515165972fd7265ce1995afea6b4c19bf

See more details on using hashes here.

File details

Details for the file better_tinker-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: better_tinker-0.1.3-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

Hashes for better_tinker-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9c468aca1562382c94291770810325ce00525eba17229f327b4df0d7abd7fc42
MD5 411bcfe2f2c4fa544cbbf7921b323aa5
BLAKE2b-256 0c77398bf01f270ee44c39a3a2ce669d3251aa11490ce571b3ae76ea666f62ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page