Typical Workflows
This guide covers the everyday workflows for tmf (TokenMofang) — browsing providers, switching between them, direct configuration for custom endpoints, saving reusable templates, testing connectivity, and rolling back when something goes wrong.
Workflow 1: Browse & Switch
Start by listing available providers, then switch one for your target application.
# List all available providers
tmf list
# Example output:
# Available providers:
# deepseek (models: deepseek-chat, deepseek-reasoner)
# openai (models: gpt-4o, gpt-4o-mini)
# claude (models: claude-sonnet-4-20250514)
# Switch to the selected provider for Claude Code
tmf use deepseek --app claude-codeWorkflow 2: Direct Configuration (set)
tmf set lets you configure any supported application with a custom API endpoint directly — no Provider API required. Ideal for self-hosted models, custom proxies, or providers not yet in the registry.
# Point Claude Code at a self-hosted Ollama instance
tmf set claude-code --baseUrl https://ollama.local/v1 --key ollama
# Configure with model and save as a reusable template
tmf set opencode --baseUrl https://proxy.example.com/v1 --key sk-xxx \
--model gpt-4o --save-as myproxyThe command auto-backs up the current config (.bak) so you can always roll back if needed.
Workflow 3: Save & Reuse Templates (save)
tmf save creates reusable parameter templates. Once saved, tmf use <name> picks up the template automatically — no need to re-enter URLs, keys, or models every time.
# Save a template for a self-hosted Ollama instance
tmf save ollama --baseUrl http://localhost:11434/v1 --key ollama --model llama3
# Save a DeepSeek template with role-based models
tmf save deepseek --app claude-code --baseUrl https://api.deepseek.com/v1 --key sk-xxx \
--models opus=deepseek-v4-pro,sonnet=deepseek-v4-pro,haiku=deepseek-v4-flash
# Apply the saved template — no need to re-specify parameters
tmf use deepseekTemplates are stored in ~/.tmf/templates/. CLI options (--key, --model, etc.) at use-time override template values.
Workflow 4: Switch & Test
After changing providers or models, it's good practice to verify connectivity immediately.
# Switch to deepseek-chat model for Codex
tmf use deepseek --app codex --model deepseek-chat
# Test the connection
tmf test deepseekIf the test passes, the new configuration is active and ready to use.
Workflow 5: Rollback After Issues
If a switch causes problems, you can quickly restore the last stable configuration.
# Roll back the specified application to its previous config
tmf rollback --app claude-codeRollback restores from an automatically created backup — no manual file editing needed.
Configuration File Locations
tmf stores its configuration and backups in the following locations:
- Global settings:
~/.tmf/config.json— contains API endpoints and other global configuration - Provider records:
~/.tmf/store/used.json— tracks which provider each application is currently using - Application config backups:
.bakfiles are created alongside each application's configuration file when a switch is performed. They store the previous config sorollbackcan restore it.
Debugging
Append the --debug flag to any command to see detailed diagnostic information:
# View detailed logs during a switch
tmf use deepseek --app claude-code --debug
# Inspect full request and response details during a test
tmf test deepseek --debug--debug prints request URLs, headers, response data, and other key information — it's the first tool to reach for when troubleshooting configuration issues.
