Metadata-Version: 2.4
Name: caio-atharva
Version: 1.0.10
Summary: Minify LLM prompts to reduce API token costs
Home-page: https://github.com/oasis-parzival/Cost-Aware-Inference-Orchestration
Author: Atharva Matale
Author-email: atharvamatale2907@gmail.com
License: MIT
Project-URL: Source, https://github.com/oasis-parzival/Cost-Aware-Inference-Orchestration
Project-URL: Tracker, https://github.com/oasis-parzival/Cost-Aware-Inference-Orchestration/issues
Keywords: llm,prompt,minify,cost,token-savings,optimizer
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25.1
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# CAIO (Cost-Aware Inference Orchestration)

[![PyPI version](https://badge.fury.io/py/caio-atharva.svg)](https://badge.fury.io/py/caio-atharva)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<img width="1894" height="872" alt="image" src="https://github.com/user-attachments/assets/77e06130-7e16-4713-a786-0b6cda62e9b5" />

**CAIO** is a high-performance optimization engine designed to drastically reduce LLM API costs. It employs a "hardcore" minification strategy that intelligently scrubs amateur conversational noise ("fluff") and compresses code-centric prompts before transmission, ensuring you only pay for the tokens that matter.

---

## Key Features

- **Generalized NLP Scrubber**: Intelligently identifies and removes non-essential conversational text (greetings, politeness, fluff) while preserving core logic and code context.
- **Code Minifier**: Strips comments, unnecessary whitespace, and formatting overhead to maximize token density.
- **Tiered Optimization**: Flexible optimization tiers (e.g., `'dev'`) to suit different stages of the development lifecycle.
- **Cost-Efficient**: Directly reduces the token count sent to providers like OpenAI, Google Gemini, and Anthropic.

---

## Installation

Install the package via pip:

```bash
pip install caio-atharva
```

---

## Usage Example

Import `CAIO`, initialize it with your target model, and start optimizing your prompts immediately.

```python
from caio import CAIO

# Initialize the optimizer. Specify your target model (default: gemini-1.5-flash)
optimizer = CAIO(model="provider-5/gemini-3-pro")

# Your original, verbose prompt
bloated_prompt = """
Hello there! I hope you are having a great day.
I'm new to Python and I was wondering if you could please help me.
Could you write a function to calculate the fibonacci sequence?
Make sure it's recursive. Thanks so much!
"""

# Optimize the prompt using the 'dev' tier for maximum efficiency
result = optimizer.optimize(bloated_prompt, tier="dev")

# Access and print the results
print(f"Original Length: {len(bloated_prompt)}")
print(f"Optimized Prompt: {result['optimized_prompt']}")
print(f"Tokens/Chars Saved: {result['tokens_saved']}")
```

### Output

The optimized prompt sent to the LLM will look like this:

```text
CODE-ONLY;NO-CHAT;MINIFY-RESPONSE: write a function to calculate the fibonacci sequence? Make sure it's recursive.
```

---

## Impact Comparison

See how CAIO transforms a standard prompt into a cost-efficient payload.

| Feature | Bloated Prompt (Expensive) | CAIO Optimized Prompt (Efficient) |
| :--- | :--- | :--- |
| **Content** | *"Hi! Please write a Python script for binary search. Thanks!"* | `CODE-ONLY;NO-CHAT;MINIFY-RESPONSE: write a Python script for binary search.` |
| **Token Load** | **High** (Includes social overhead) | **Low** (Pure instruction & code) |
| **Cost** | **$$$** ( paying for "Please" and "Thanks" ) | **$** ( Paying only for logic ) |
| **Latency** | Slower processing of extra text | Faster inference |

---

## Project Structure

```text
CAIO-SDK/
â”œâ”€â”€ caio/
â”‚   â”œâ”€â”€ __init__.py
â”‚   â””â”€â”€ optimizer.py  # Core logic: CAIO class & NLP scrubber
â”œâ”€â”€ setup.py          # Package configuration
â””â”€â”€ README.md         # Documentation
```

---

## Metadata

- **Developer**: [Atharva Matale](https://www.linkedin.com/in/atharvamatale/)
- **License**: MIT License
- **Version**: 1.0.7
- **Version**: 1.0.10

---

*Maximize efficient inference. Minimize costs. Use CAIO.*
