Skip to main content

AI Token Optimizer CLI

Command-line tool for optimizing prompts sent to AI coding assistants.

Installation

pip install ai-optimize

Or install from source:

pip install -e .

Usage

Basic optimization

# Use default optimization (lite mode)
ai-opt "fix the bug in auth.py"

# Use ultra mode for maximum savings
ai-opt --mode ultra "add error handling"

# Use verbose mode for detailed explanations
ai-opt --mode verbose "explain this algorithm"

Dry run

Preview the optimized prompt without executing:

ai-opt --dry-run "refactor this function"

Statistics

# Show usage statistics
ai-opt stats

# Show today's statistics
ai-opt stats --today

# Export statistics
ai-opt stats --export json
ai-opt stats --export csv

Configuration

# Create a config file in the current directory
ai-opt config init

# Create a global config file
ai-opt config init --global

# Show current configuration
ai-opt config show

# Validate configuration
ai-opt config validate

Tool management

# List supported tools
ai-opt tools list

# Detect available tools
ai-opt tools detect

Optimization modes

Mode Savings Description
ultra 60-80% Code only, no explanations
lite 40-60% Code-first with brief explanations
verbose 0-20% Full explanations and context

Configuration file

Create .ai-optimize.yml in your project root:

version: "1.0"

optimization:
  mode: "lite"

rules:
  skip_preamble: true
  skip_postamble: true
  code_first: true
  max_explanation_length: 50

context:
  exclude_patterns:
    - "node_modules/**"
    - "dist/**"

tracking:
  enabled: true

License

MIT

Metadata

Release files for ai-optimize 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-optimize 0.1.1
File Size Uploaded Provenance Actions
ai_optimize-0.1.1.tar.gz 19.7 kB Without provenance Details for ai_optimize-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-optimize 0.1.1
File Interpreter ABI Platform Actions
ai_optimize-0.1.1-py3-none-any.whl Python 3 none any Details for ai_optimize-0.1.1-py3-none-any.whl

Total release size: 40.9 kB

Release files / ai_optimize-0.1.1.tar.gz

Download URL ai_optimize-0.1.1.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d8a212451e9f67a397cb2c57a7ed58b904583a4a93c994816ad0d8919bc3bb09
BLAKE2b-256 checksum
How to use checksums
b8c70e54893a251729305117353cdad7f14eabaef3db9c21dd9317d51a64ad38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / ai_optimize-0.1.1-py3-none-any.whl

Download URL ai_optimize-0.1.1-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e32542ade0217bb46f8600c09f6ae7ad237df5f3d34d31d850c6a7f2e676c08
BLAKE2b-256 checksum
How to use checksums
c9298069f5d4382c2c53cf95121e90c76ff7da2da7ab6796d066fc7b49829a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for ai-optimize 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page