Principle:Togethercomputer Together python CLI Interface
| Knowledge Sources | |
|---|---|
| Domains | CLI, API |
| Last Updated | 2026-02-15 16:00 GMT |
Overview
Principle for providing command-line access to the Together AI platform APIs through a structured CLI tool.
Description
The CLI interface principle covers providing terminal-based access to all Together AI APIs through a hierarchical command structure. The CLI bootstraps a client with authentication and configuration, then delegates to subcommand groups for each API domain (chat, completions, images, files, fine-tuning, models, endpoints, evaluation). It follows conventions of outputting machine-readable data (IDs, JSON) to stdout and human-readable status to stderr for scriptability.
Usage
Apply this principle when you need terminal-based automation, scripting, or interactive exploration of the Together AI platform without writing Python code.
Theoretical Basis
CLI tools follow a hierarchical command group pattern:
Pseudo-code Logic:
# Abstract CLI structure
cli = create_root_group(global_options=[api_key, base_url, timeout])
cli.register(chat_commands)
cli.register(models_commands)
cli.register(endpoints_commands)
# ... etc
# Execution flow
client = init_client(global_options)
result = dispatch_command(client, subcommand, args)
output_to_stdout(result.data)
output_to_stderr(result.status)
Key considerations:
- Scriptability: Machine-readable output (IDs) to stdout, status to stderr
- Authentication: API key via --api-key flag or TOGETHER_API_KEY env var
- Subcommand Groups: Organized by API domain for discoverability
- Output Formats: Most commands support --json flag for structured output