A cross-platform CLI tool to fix typos using LLM.
Project description
typofix
A cross-platform CLI tool to fix typos and improve text with an LLM that supports both Chinese and English.
- Default behavior:
typofix <TEXT>runs typo-fixing (no subcommand needed). - Extra modes:
--suggest(suggest improvements + reasons),--rewrite(rewrite alternatives). - Clipboard: in default fix mode, the final text is copied to clipboard.
- Supports OpenAI-compatible providers.
Requirements
- Python: >= 3.9
Installation
Local (recommended for development)
pip install -e .
Regular install
pip install typofix
Quickstart
- Configure API key and (optionally) model:
typofix config --api-key YOUR_KEY
# optional:
typofix config --model MODEL_NAME
- Fix a sentence:
typofix "Helo world"
Usage
Default (fix)
Fix grammar/typos with minimal changes.
typofix "这是一段可能由语病的测试"
The output is also copied to clipboard in fix mode.
Suggest improvements (with explanations)
Gives prioritized suggestions and brief reasons.
typofix --suggest "This sentence have a problem."
Rewrite
Provides 2–3 rewritten alternatives.
typofix --rewrite "帮我把这句话写得更自然一点"
From stdin (pipes)
echo "Helo world" | typofix
Help
typofix --help shows the default command help. Configuration is available as a command:
typofix config --help
Configuration
Configuration is stored under your home directory (JSON). You can always re-run the config command to update values.
Set / view configuration
typofix config
Set model
typofix config --model MODEL_NAME
List available models
Lists models available to your API key (and the configured base URL).
typofix config --list
Use an OpenAI-compatible provider (base URL)
This tool supports OpenAI-compatible APIs by configuring --base-url.
Example (DashScope compatible mode):
typofix config --base-url https://dashscope.aliyuncs.com/compatible-mode/v1
# then set provider key + model
typofix config --api-key YOUR_PROVIDER_KEY
typofix config --model qwen-plus
Switch back to OpenAI:
typofix config --base-url https://api.openai.com/v1
Troubleshooting
- "API key not configured": run
typofix config --api-key YOUR_KEY. - "No such command '
- Model list fails: verify
--base-urland--api-keyare correct for your provider.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typofix-0.2.0.tar.gz.
File metadata
- Download URL: typofix-0.2.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6514f3daed946190adb51bd664b75adf0ea8e1d46c0317cbfc47663d175c84a
|
|
| MD5 |
1b7a6e4a5778ac32e033bb1cd4ab0926
|
|
| BLAKE2b-256 |
a070a17d94f31cde9de4a479e0c1a67891f52960d9ad198f788961f4ceabf12b
|
File details
Details for the file typofix-0.2.0-py3-none-any.whl.
File metadata
- Download URL: typofix-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e55d807bb0f14e1fd0486debb56dbc98ff482d320f8b6d49ceb973cfee03f60
|
|
| MD5 |
56d21ad0e1fd6198f681e7b10823380f
|
|
| BLAKE2b-256 |
0a61b3de832dfd9199dcf51afef174f0c70665dd1d902507d67aaa5b75bd081e
|