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 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

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)    โ”‚                 โ”‚             โ”‚
โ”‚             โ”‚                          โ”‚                 โ”‚                 โ”‚             โ”‚
โ”‚ Reads key   โ”‚                          โ”‚ Uses key from   โ”‚                 โ”‚             โ”‚
โ”‚ from keyringโ”‚                          โ”‚ header (no      โ”‚                 โ”‚             โ”‚
โ”‚ (1 prompt)  โ”‚                          โ”‚ keyring access) โ”‚                 โ”‚             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Design Decision: The Go CLI is the only component that accesses the system keyring. The API key is passed to the bridge via HTTP Authorization header, eliminating the double password prompt issue on macOS.

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 will be stored securely in your OS keyring:
    • Windows: Credential Manager
    • macOS: Keychain
    • Linux: Secret Service (GNOME Keyring, KWallet, etc.)

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"'

Platform-Specific Notes

macOS

  • Keychain Access: The first time you run better-tinker, macOS may prompt for your password to allow keychain access. Click "Always Allow" to avoid future prompts.
  • Unsigned Binary Warning: If macOS blocks the binary, go to System Preferences > Security & Privacy and click "Open Anyway"
  • Code Signing: The binaries are ad-hoc signed to reduce Keychain prompts

Windows

  • Credential Manager: API keys are stored in Windows Credential Manager under tinker-cli:api-key
  • Firewall: The bridge server runs on 127.0.0.1:8765. Windows Firewall may ask to allow it (this is local-only traffic)

Linux

  • Secret Service: Requires a running secret service daemon (GNOME Keyring, KWallet, etc.)
  • Headless Servers: On servers without a desktop environment, use the TINKER_API_KEY environment variable instead

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 keyring)
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
    

Double password prompt on macOS

This issue has been fixed in v0.2.0+. If you still experience it:

  1. Update to the latest version: uvx --refresh better-tinker
  2. Use environment variable instead of keyring:
    export TINKER_API_KEY="your-key"
    uvx better-tinker
    

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/mohadese/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
โ”œโ”€โ”€ better_tinker/
โ”‚   โ”œโ”€โ”€ wrapper.py          # Python wrapper (starts bridge + Go CLI)
โ”‚   โ”œโ”€โ”€ bin/                # Pre-built Go binaries
โ”‚   โ”‚   โ”œโ”€โ”€ tinker-cli-windows.exe
โ”‚   โ”‚   โ”œโ”€โ”€ tinker-cli-linux
โ”‚   โ”‚   โ”œโ”€โ”€ tinker-cli-darwin
โ”‚   โ”‚   โ””โ”€โ”€ tinker-cli-darwin-arm64
โ”‚   โ””โ”€โ”€ bridge/
โ”‚       โ””โ”€โ”€ server.py       # FastAPI bridge server
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ client.go       # REST API client (calls bridge)
โ”‚   โ”‚   โ””โ”€โ”€ types.go        # API response types
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ keyring.go      # Secure credential storage
โ”‚   โ””โ”€โ”€ ui/
โ”‚       โ”œโ”€โ”€ app.go          # Bubble Tea app model
โ”‚       โ”œโ”€โ”€ styles.go       # Lip Gloss styles
โ”‚       โ””โ”€โ”€ views/          # UI views
โ”œโ”€โ”€ 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.2.3.tar.gz (23.9 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.2.3-py3-none-any.whl (12.2 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: better_tinker-0.2.3.tar.gz
  • Upload date:
  • Size: 23.9 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.2.3.tar.gz
Algorithm Hash digest
SHA256 d956c795b91c0cae3e4bb9d832a7e5fa4a00ee91d2d2b48ed0cb1aa979512a9e
MD5 8df4e2c8334acb314550171eb9a63a3f
BLAKE2b-256 d864be8574edb0efe80872418202b01274618868d399e7f2ee7567cd2a60fb80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: better_tinker-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 12.2 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.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 159506a68195fdaa8c547f4516a28b9b8a5e13f232cabd2879919c3e14a8ce62
MD5 8f58a337f26e8657e65ef9b9bedd875c
BLAKE2b-256 b9dc0e53e16d09cd5d63619f0bf4250edee8791abceaa1f04960be972370c8a6

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