Prompts Aligned to Guidelines and Normalization System for OpenAI, Anthropic, xAI, and Google models
Project description
PAGANS - Prompt Optimization Framework
PAGANS (Prompts Aligned to Guidelines and Normalization System) is a prompt optimization framework for LLM applications. It adapts prompts to the target model family automatically so the same prompt can perform better across OpenAI, Anthropic, Google, and xAI model series through OpenRouter.
✨ Features
- 🚀 Fast prompt optimization for production workflows
- 🎯 Family-aware optimization for OpenAI, Anthropic, Google, and xAI models
- 🔍 Automatic model-family detection from short and provider-prefixed names
- ⚡ Async-first API for single, compare, and batch operations
- 🧠 Built-in caching to reduce repeated optimization cost
- 🛠️ CLI support for optimize, compare, and batch workflows
- 🔗 Unified OpenRouter integration path
Installation
pip install pagans
Quick Start
import asyncio
from pagans import PAGANSOptimizer
async def main() -> None:
async with PAGANSOptimizer() as optimizer:
result = await optimizer.optimize(
prompt="Write a robust retry policy for external API calls.",
target_model="openai/gpt-4o",
)
print(result.optimized)
asyncio.run(main())
Required environment variable:
export OPENROUTER_API_KEY="your-openrouter-api-key"
Optional environment variables:
export OPENROUTER_BASE_URL="https://openrouter.ai/api/v1"
export PAGANS_OPTIMIZER_MODEL="openai/gpt-4o-mini"
CLI
PAGANS installs a CLI as pagans.
pagans optimize --prompt "Explain quantum computing for beginners" --target-model gpt-4o
pagans compare \
--prompt "Design an event-driven order system" \
--models "gpt-4o,claude-sonnet-4,gemini-2.5-pro"
pagans batch --prompts-file ./prompts.txt --target-model gemini-2.5-pro
🎯 Model Family Series
PAGANS optimizes prompts for these model families and series:
- OpenAI GPT series
- Anthropic Claude series
- Google Gemini series
- xAI Grok series
PAGANS detects the target model family and applies the matching optimization strategy automatically.
Links
- Source: https://github.com/abubakarsiddik31/pagans
- Issues: https://github.com/abubakarsiddik31/pagans/issues
License
MIT
Project details
Release history Release notifications | RSS feed
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 pagans-0.1.3.tar.gz.
File metadata
- Download URL: pagans-0.1.3.tar.gz
- Upload date:
- Size: 335.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f04eab13acc55576ef51bc813edd07e0d701d24ae1d671b9d55c5c9e2e0eaeee
|
|
| MD5 |
6fcf7d3d56e4b1f0640b3088160dd076
|
|
| BLAKE2b-256 |
68e209f2a8cbe194822e3b01e4faa8778e87a25529c85550935512b148e5f362
|
File details
Details for the file pagans-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pagans-0.1.3-py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e58ecc9629037f53022e2195e70b3d83ef8d69529ebe119d8ec6bbae4291a385
|
|
| MD5 |
40a4e5957a13920c64bd268e8a347aad
|
|
| BLAKE2b-256 |
d951d1f6ba607a835916878bc1894c16f9559c88f27999af5e0ab3a396a39648
|