Skip to main content

Tinker CLI wrapper and bridge

Project description

Better Tinker

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

Go Python License

Features

  • ๐Ÿš€ Training Runs - View and manage your training runs with expandable tree view
  • ๐Ÿ’พ Checkpoints - Browse, publish/unpublish, and delete model checkpoints
  • ๐Ÿ“Š Usage Statistics - View your API usage and quotas
  • โš™๏ธ Settings - Configure API key (stored in local config file)
  • โœจ Interactive UI - Beautiful dark theme with keyboard navigation

Quick Start

Option 1: Using uv/uvx (Recommended)

# Install uv if you don't have it
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

# Run directly (downloads and runs in isolated environment)
uvx better-tinker

Option 2: Using pip

pip install better-tinker
better-tinker

Architecture

This CLI uses a Python bridge server to communicate with the Tinker API. The bridge is started automatically when you run better-tinker.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   Authorization Header   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     gRPC-Web    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Go CLI     โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  Python Bridge  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ Tinker API  โ”‚
โ”‚ (Bubble Tea)โ”‚   Bearer <api_key>       โ”‚    (FastAPI)    โ”‚                 โ”‚             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Configuration

Option 1: Use the Settings Menu (Recommended)

The easiest way to configure your API key is through the CLI itself:

  1. Run better-tinker
  2. Select Settings from the menu
  3. Select API Key and enter your key
  4. The key is stored in a local config file:
    • Windows: %APPDATA%\tinker-cli\config.json
    • macOS/Linux: ~/.config/tinker-cli/config.json

Option 2: Environment Variable

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

# Then run
better-tinker

Note: Environment variables take precedence over stored credentials.

Persistent Environment Variable (Recommended for uvx)

If you use uvx, setting the environment variable in your shell config is the most reliable method:

macOS/Linux (bash/zsh):

echo 'export TINKER_API_KEY="your-api-key-here"' >> ~/.zshrc
source ~/.zshrc

Windows (PowerShell profile):

# Add to your PowerShell profile
Add-Content $PROFILE 'setx TINKER_API_KEY "your-api-key-here"'

Keyboard Controls

Key Action
โ†‘/k Move up
โ†“/j Move down
Enter Select / Confirm / Edit
Space Expand/collapse training run
r Refresh data
p Publish/Unpublish checkpoint
d Delete checkpoint / Delete API key (in Settings)
Esc Go back / Cancel editing
q Quit

Environment Variables

Variable Description Default
TINKER_API_KEY Your Tinker API key (from config)
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

Troubleshooting

"API key required" error

Set your API key using one of these methods:

  1. Via Settings menu (recommended):

    better-tinker
    # Navigate to Settings > API Key
    
  2. Via environment variable:

    export TINKER_API_KEY="your-api-key-here"
    better-tinker
    

"Tinker SDK not installed" error

This usually means the Python environment is missing dependencies. Try:

# Reinstall with fresh environment
uvx --refresh better-tinker

# Or with pip
pip install --upgrade better-tinker tinker

"Bridge server not running" error

The bridge should start automatically. If it fails:

  1. Check if port 8765 is already in use
  2. Try manually starting the bridge:
    python -m better_tinker.bridge.server
    

API Documentation

When the bridge server is running, you can access the interactive API documentation at:

Development

Build from source

git clone https://github.com/mohaddz/better-tinker.git
cd better-tinker

# Build Go binaries for all platforms
python build_binaries.py

# Install in development mode
pip install -e .

# Run
better-tinker

Project Structure

better-tinker/
โ”œโ”€โ”€ main.go                 # Go CLI entry point (thin wrapper around internal/tui)
โ”œโ”€โ”€ better_tinker/
โ”‚   โ”œโ”€โ”€ wrapper.py          # Python wrapper (starts bridge + Go CLI)
โ”‚   โ””โ”€โ”€ bridge/
โ”‚       โ””โ”€โ”€ server.py       # FastAPI bridge server
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ client.go       # REST API client (calls bridge)
โ”‚   โ”‚   โ””โ”€โ”€ types.go        # API response types
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ config.go       # Configuration / credential storage
โ”‚   โ”œโ”€โ”€ tui/
โ”‚   โ”‚   โ”œโ”€โ”€ program.go      # Bubble Tea program wiring
โ”‚   โ”‚   โ”œโ”€โ”€ model.go        # App state + initial model
โ”‚   โ”‚   โ”œโ”€โ”€ update.go       # Update loop + navigation logic
โ”‚   โ”‚   โ”œโ”€โ”€ views.go        # View rendering
โ”‚   โ”‚   โ”œโ”€โ”€ commands.go     # Async commands (API calls)
โ”‚   โ”‚   โ”œโ”€โ”€ types.go        # Msg/types used by the TUI
โ”‚   โ”‚   โ”œโ”€โ”€ layout.go       # Layout helpers
โ”‚   โ”‚   โ”œโ”€โ”€ util.go         # Small helpers
โ”‚   โ”‚   โ””โ”€โ”€ menu_delegate.go # Custom menu renderer
โ”‚   โ””โ”€โ”€ ui/
โ”‚       โ”œโ”€โ”€ styles.go       # Lip Gloss styles
โ”œโ”€โ”€ build_binaries.py       # Cross-compilation script
โ”œโ”€โ”€ pyproject.toml          # Python package config
โ””โ”€โ”€ go.mod                  # Go module config

Tech Stack

Go CLI

Python Bridge

  • Web Framework: FastAPI
  • ASGI Server: Uvicorn
  • Tinker SDK: Official Python SDK for Tinker API

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.4.0.tar.gz (12.2 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.4.0-py3-none-any.whl (12.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: better_tinker-0.4.0.tar.gz
  • Upload date:
  • Size: 12.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"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.4.0.tar.gz
Algorithm Hash digest
SHA256 24a45bf7cd044900c898c523ed4dd2ae2052a36846d476a597835fd559bc6c6a
MD5 6485cb13d89bde8d6442ab301f7d47bd
BLAKE2b-256 af7e3902c15000fd5877a532979665ee3228e2a89a21831817d14167218e41e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: better_tinker-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71e240f5174ae94523989d5224a700a30f783b6189bffb23756ae5a5458a6cae
MD5 f07fb049a178e71a0ed838812204b345
BLAKE2b-256 19844eea1f019e5d15efbe45396bf2376ff99ae4e8acc521d6e2185d24aac456

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