llmoptimize 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. llmoptimize-1.0.0/MANIFEST.in +32 -0
  2. llmoptimize-1.0.0/PKG-INFO +164 -0
  3. llmoptimize-1.0.0/README.md +116 -0
  4. llmoptimize-1.0.0/aioptimize/__init__.py +560 -0
  5. llmoptimize-1.0.0/aioptimize/agent_classifier.py +419 -0
  6. llmoptimize-1.0.0/aioptimize/agent_decorator.py +724 -0
  7. llmoptimize-1.0.0/aioptimize/agent_tracker.py +428 -0
  8. llmoptimize-1.0.0/aioptimize/aiauditor.py +647 -0
  9. llmoptimize-1.0.0/aioptimize/cache_manager.py +470 -0
  10. llmoptimize-1.0.0/aioptimize/cli.py +192 -0
  11. llmoptimize-1.0.0/aioptimize/cli_groq.py +332 -0
  12. llmoptimize-1.0.0/aioptimize/cloud_sync.py +219 -0
  13. llmoptimize-1.0.0/aioptimize/cloud_sync_collector.py +311 -0
  14. llmoptimize-1.0.0/aioptimize/config.py +58 -0
  15. llmoptimize-1.0.0/aioptimize/context_optimizer.py +899 -0
  16. llmoptimize-1.0.0/aioptimize/data_collector.py +285 -0
  17. llmoptimize-1.0.0/aioptimize/groq_auditor.py +281 -0
  18. llmoptimize-1.0.0/aioptimize/groq_model_selector.py +999 -0
  19. llmoptimize-1.0.0/aioptimize/guardrail.py +388 -0
  20. llmoptimize-1.0.0/aioptimize/heuristic_analyzer.py +158 -0
  21. llmoptimize-1.0.0/aioptimize/llm_analyzer.py +114 -0
  22. llmoptimize-1.0.0/aioptimize/loop_detector.py +1104 -0
  23. llmoptimize-1.0.0/aioptimize/ml_trainer.py +429 -0
  24. llmoptimize-1.0.0/aioptimize/models.py +51 -0
  25. llmoptimize-1.0.0/aioptimize/patcher.py +627 -0
  26. llmoptimize-1.0.0/aioptimize/rag_analyzer.py +502 -0
  27. llmoptimize-1.0.0/aioptimize/report_formatter.py +197 -0
  28. llmoptimize-1.0.0/aioptimize/smart_analyzer.py +382 -0
  29. llmoptimize-1.0.0/aioptimize/tracker.py +567 -0
  30. llmoptimize-1.0.0/license.txt +106 -0
  31. llmoptimize-1.0.0/llmoptimize.egg-info/SOURCES.txt +31 -0
  32. llmoptimize-1.0.0/requirements.txt +20 -0
  33. llmoptimize-1.0.0/setup.cfg +4 -0
  34. llmoptimize-1.0.0/setup.py +59 -0
@@ -0,0 +1,32 @@
1
+ # MANIFEST.in - Files to include in source distribution
2
+
3
+ # Documentation files
4
+ include README.md
5
+ include LICENSE
6
+
7
+ # Requirements files
8
+ include requirements.txt
9
+ include requirements-dev.txt
10
+
11
+ # Config
12
+ include setup.py
13
+
14
+ # Exclude secrets and config
15
+ exclude .gitignore
16
+ exclude .env
17
+ exclude .env.*
18
+ exclude railway.json
19
+
20
+ # Exclude directories
21
+ prune test
22
+ prune tests
23
+ prune server
24
+ prune .aioptimize_cache
25
+ prune __pycache__
26
+ prune *.egg-info
27
+ prune dist
28
+ prune build
29
+ prune .pytest_cache
30
+ prune .mypy_cache
31
+ prune .venv
32
+ prune venv
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.4
2
+ Name: llmoptimize
3
+ Version: 1.0.0
4
+ Summary: Reduce LLM API costs by 90% with automatic tracking and AI-powered recommendations
5
+ Home-page: https://github.com/hackrudra1234/aioptimize
6
+ Author: AIOptimize Team
7
+ Author-email: support@aioptimize.dev
8
+ License: Proprietary
9
+ Project-URL: Source Code, https://github.com/hackrudra1234/aioptimize
10
+ Project-URL: Bug Reports, https://github.com/hackrudra1234/aioptimize/issues
11
+ Keywords: ai,llm,cost,optimization,openai,anthropic,claude,gpt,groq,gemini
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Classifier: License :: Other/Proprietary License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: license.txt
25
+ Requires-Dist: requests>=2.31.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
28
+ Requires-Dist: black>=23.0.0; extra == "dev"
29
+ Provides-Extra: server
30
+ Requires-Dist: fastapi>=0.104.1; extra == "server"
31
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "server"
32
+ Requires-Dist: sqlalchemy>=2.0.23; extra == "server"
33
+ Requires-Dist: psycopg2-binary>=2.9.9; extra == "server"
34
+ Dynamic: author
35
+ Dynamic: author-email
36
+ Dynamic: classifier
37
+ Dynamic: description
38
+ Dynamic: description-content-type
39
+ Dynamic: home-page
40
+ Dynamic: keywords
41
+ Dynamic: license
42
+ Dynamic: license-file
43
+ Dynamic: project-url
44
+ Dynamic: provides-extra
45
+ Dynamic: requires-dist
46
+ Dynamic: requires-python
47
+ Dynamic: summary
48
+
49
+ # AIOptimize - Reduce LLM API Costs by 90%
50
+
51
+ **Drop-in SDK that automatically tracks costs, recommends cheaper models, and optimizes AI workflows.**
52
+
53
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
54
+ [![License: Proprietary](https://img.shields.io/badge/License-Proprietary-red.svg)](LICENSE)
55
+
56
+ ---
57
+
58
+ ## 🚀 Quick Start
59
+
60
+ ```bash
61
+ pip install aioptimize
62
+ ```
63
+
64
+ ```python
65
+ import aioptimize # That's it! Auto-tracks all API calls
66
+
67
+ # Your code works exactly the same
68
+ import openai
69
+ client = openai.OpenAI()
70
+ response = client.chat.completions.create(
71
+ model="gpt-4",
72
+ messages=[{"role": "user", "content": "Hello!"}]
73
+ )
74
+
75
+ # See your costs and savings
76
+ aioptimize.report()
77
+ ```
78
+
79
+ **Output:**
80
+ ```
81
+ 💰 COST REPORT
82
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
83
+ Total Calls: 47
84
+ Total Cost: $2.34
85
+ Potential Savings: $2.11 (90%)
86
+
87
+ 💡 RECOMMENDATIONS
88
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
89
+ ✓ Use gpt-3.5-turbo instead of gpt-4 for simple tasks
90
+ ✓ Estimated savings: $1.85/day
91
+ ```
92
+
93
+ ---
94
+
95
+ ## ✨ Features
96
+
97
+ ### 🎯 **Magic Mode** (Default)
98
+ Zero code changes - just `import aioptimize` and it works.
99
+
100
+ ### 🤖 **AI-Powered Recommendations**
101
+ Smart analysis of each API call with confidence scores and reasoning.
102
+
103
+ ### 📊 **Comprehensive Tracking**
104
+ - Real-time cost tracking
105
+ - Token usage analytics
106
+ - Model performance insights
107
+ - Automatic report generation
108
+
109
+ ### 🔍 **Code Auditing**
110
+ Analyze Python code BEFORE running to find optimization opportunities.
111
+
112
+ ### 🎭 **Agent Optimization**
113
+ Track multi-step AI agent workflows with loop detection and context optimization.
114
+
115
+ ---
116
+
117
+ ## 🎁 Free Trial
118
+
119
+ **100 calls with full access to all features - no credit card required.**
120
+
121
+ After 100 calls, choose your plan:
122
+ - **Starter:** 299 Rs./month - Unlimited
123
+
124
+ ---
125
+
126
+ ## 📦 Supported Providers
127
+
128
+ ✅ **OpenAI** (GPT-4, GPT-4o, o1, o3, embeddings)
129
+ ✅ **Anthropic** (Claude 3, Claude 3.5)
130
+ ✅ **Google** (Gemini 1.5, 2.0)
131
+ ✅ **Groq** (Llama, Mixtral, Gemma)
132
+ ✅ **Mistral** (Large, Small, Nemo)
133
+ ✅ **Cohere** (Command R+)
134
+
135
+ **72+ models tracked automatically.**
136
+
137
+ ---
138
+
139
+ ## 🔐 Privacy & Security
140
+
141
+ ✅ **No prompt content sent** - Only categories
142
+ ✅ **API keys stay local** - Never sent to our servers
143
+ ✅ **Anonymized data only** - Random session IDs
144
+ ✅ **GDPR compliant** - Full data export available
145
+
146
+ ---
147
+
148
+ ## 📝 License
149
+
150
+ Proprietary - See [LICENSE](LICENSE) file.
151
+
152
+ Free 100-call trial included. Paid license required for continued use.
153
+
154
+ ---
155
+
156
+ ## 🤝 Support
157
+
158
+ - 📧 Email: hackrudra@gmail.com
159
+ - 📚 Docs: [Full documentation](#)
160
+ - 🐛 Issues: [GitHub Issues](https://github.com/hackrudra1234/aioptimize/issues)
161
+
162
+ ---
163
+
164
+ **Made with ❤️ by AIOptimize Team**
@@ -0,0 +1,116 @@
1
+ # AIOptimize - Reduce LLM API Costs by 90%
2
+
3
+ **Drop-in SDK that automatically tracks costs, recommends cheaper models, and optimizes AI workflows.**
4
+
5
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: Proprietary](https://img.shields.io/badge/License-Proprietary-red.svg)](LICENSE)
7
+
8
+ ---
9
+
10
+ ## 🚀 Quick Start
11
+
12
+ ```bash
13
+ pip install aioptimize
14
+ ```
15
+
16
+ ```python
17
+ import aioptimize # That's it! Auto-tracks all API calls
18
+
19
+ # Your code works exactly the same
20
+ import openai
21
+ client = openai.OpenAI()
22
+ response = client.chat.completions.create(
23
+ model="gpt-4",
24
+ messages=[{"role": "user", "content": "Hello!"}]
25
+ )
26
+
27
+ # See your costs and savings
28
+ aioptimize.report()
29
+ ```
30
+
31
+ **Output:**
32
+ ```
33
+ 💰 COST REPORT
34
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
35
+ Total Calls: 47
36
+ Total Cost: $2.34
37
+ Potential Savings: $2.11 (90%)
38
+
39
+ 💡 RECOMMENDATIONS
40
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
41
+ ✓ Use gpt-3.5-turbo instead of gpt-4 for simple tasks
42
+ ✓ Estimated savings: $1.85/day
43
+ ```
44
+
45
+ ---
46
+
47
+ ## ✨ Features
48
+
49
+ ### 🎯 **Magic Mode** (Default)
50
+ Zero code changes - just `import aioptimize` and it works.
51
+
52
+ ### 🤖 **AI-Powered Recommendations**
53
+ Smart analysis of each API call with confidence scores and reasoning.
54
+
55
+ ### 📊 **Comprehensive Tracking**
56
+ - Real-time cost tracking
57
+ - Token usage analytics
58
+ - Model performance insights
59
+ - Automatic report generation
60
+
61
+ ### 🔍 **Code Auditing**
62
+ Analyze Python code BEFORE running to find optimization opportunities.
63
+
64
+ ### 🎭 **Agent Optimization**
65
+ Track multi-step AI agent workflows with loop detection and context optimization.
66
+
67
+ ---
68
+
69
+ ## 🎁 Free Trial
70
+
71
+ **100 calls with full access to all features - no credit card required.**
72
+
73
+ After 100 calls, choose your plan:
74
+ - **Starter:** 299 Rs./month - Unlimited
75
+
76
+ ---
77
+
78
+ ## 📦 Supported Providers
79
+
80
+ ✅ **OpenAI** (GPT-4, GPT-4o, o1, o3, embeddings)
81
+ ✅ **Anthropic** (Claude 3, Claude 3.5)
82
+ ✅ **Google** (Gemini 1.5, 2.0)
83
+ ✅ **Groq** (Llama, Mixtral, Gemma)
84
+ ✅ **Mistral** (Large, Small, Nemo)
85
+ ✅ **Cohere** (Command R+)
86
+
87
+ **72+ models tracked automatically.**
88
+
89
+ ---
90
+
91
+ ## 🔐 Privacy & Security
92
+
93
+ ✅ **No prompt content sent** - Only categories
94
+ ✅ **API keys stay local** - Never sent to our servers
95
+ ✅ **Anonymized data only** - Random session IDs
96
+ ✅ **GDPR compliant** - Full data export available
97
+
98
+ ---
99
+
100
+ ## 📝 License
101
+
102
+ Proprietary - See [LICENSE](LICENSE) file.
103
+
104
+ Free 100-call trial included. Paid license required for continued use.
105
+
106
+ ---
107
+
108
+ ## 🤝 Support
109
+
110
+ - 📧 Email: hackrudra@gmail.com
111
+ - 📚 Docs: [Full documentation](#)
112
+ - 🐛 Issues: [GitHub Issues](https://github.com/hackrudra1234/aioptimize/issues)
113
+
114
+ ---
115
+
116
+ **Made with ❤️ by AIOptimize Team**