fortress-optimizer
Cut your LLM API costs by 10-20%. Drop-in prompt optimization for Python.
pip install fortress-optimizer
3-Line Quick Start
from fortress_optimizer import FortressClient
client = FortressClient(api_key="fk_your_key_here")
result = client.optimize("Can you please help me write a detailed and comprehensive analysis of this data")
print(result["optimization"]["optimized_prompt"])
# → "Write a detailed analysis of this data"
print(f"Saved {result['tokens']['savings_percentage']}% tokens")
# → "Saved 18% tokens"
50,000 tokens/month free. No credit card required. Get a key at fortress-optimizer.com
Why?
Every token you send to GPT-4, Claude, or Gemini costs money. Most prompts contain filler words, redundant phrases, and unnecessary politeness that inflate token counts without improving results.
Fortress compresses your prompts server-side — same meaning, fewer tokens, lower cost.
Before / After
# Before: 22 tokens
prompt = "Could you please help me analyze this sales data and provide detailed insights and recommendations?"
result = client.optimize(prompt, level="aggressive")
# After: 12 tokens
print(result["optimization"]["optimized_prompt"])
# → "Analyze sales data, provide insights and recommendations"
print(f"{result['tokens']['savings']} tokens saved ({result['tokens']['savings_percentage']}%)")
# → "10 tokens saved (45%)"
Optimization Levels
| Level | Savings | Best For |
|---|---|---|
conservative |
~5% | Production prompts where every word matters |
balanced |
~15% | General use (default) |
aggressive |
~20% | Cost-sensitive batch processing |
Full API
client = FortressClient(
api_key="fk_your_key",
base_url="https://api.fortress-optimizer.com", # default
)
# Optimize a prompt
result = client.optimize(prompt, level="balanced", provider="openai")
# result["optimization"]["optimized_prompt"]
# result["tokens"]["original"], ["optimized"], ["savings"], ["savings_percentage"]
# Check usage
usage = client.get_usage()
# usage["tokens_remaining"], usage["tier"], usage["reset_date"]
# List providers
providers = client.get_providers()
# Health check
is_healthy = client.health_check()
Batch Optimization
prompts = [
"Please analyze this data and provide your insights",
"Can you help me understand what this code does in detail",
"I would like you to summarize the key points of this document",
]
results = [client.optimize(p, level="balanced") for p in prompts]
total_saved = sum(r["tokens"]["savings"] for r in results)
print(f"Saved {total_saved} tokens across {len(results)} prompts")
Providers
OpenAI, Anthropic, Azure, Google Gemini, Groq, Ollama — pass the provider name and the optimizer tailors compression to each tokenizer.
Pricing
| Plan | Price | Tokens |
|---|---|---|
| Free | $0 | 50,000/month |
| Pro | $15/month | Unlimited |
| Teams | From $60/month | Unlimited + team management |
| Enterprise | Custom | Dedicated support + SLAs |
Links
License
MIT
Release files for fortress-optimizer 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fortress_optimizer-1.0.1.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fortress_optimizer-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / fortress_optimizer-1.0.1.tar.gz
| Download URL | fortress_optimizer-1.0.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc0bcabff93186e9ca69327ae72de0fad02721256c2870e2a9c476e00a19558c
|
|
BLAKE2b-256 checksum How to use checksums |
2b4c3fc7b00dc82c4dfecd6f1f70cf59668bed29bccc7bfe630ad4f7ed85096b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / fortress_optimizer-1.0.1-py3-none-any.whl
| Download URL | fortress_optimizer-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ca9bccd5c6adf19bd84394933b4530cacba304414be63371fcfa56c8fcaac94
|
|
BLAKE2b-256 checksum How to use checksums |
9097ed0edf89c4b93f89fade64de6e769190dc49e5b8833a576ef846d7be9a2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|