Building multi-provider LLM workflows is annoying. KePrompt just shipped a DSL that makes switching providers a one-line edit.
A developer named Jerry Westrick got tired of rewriting boilerplate every time he moved between OpenAI, Anthropic, and Google. So he built KePrompt: a CLI tool with a simple .prompt file format that runs against any provider. Change gpt-4o to claude-sonnet-4-20250514 in the header. Done. No code rewrites, no refactoring your API calls.
That’s the practical part. Here’s the twist.
Jerry runs a real produce distribution business in Mérida, Mexico. Orders come in via Telegram in Spanish:
Patty: #28 ANONIMA – 350gr de arugula – 100gr de menta
Bot: Remisión: REM26-454 (#28), Cliente: ANONIMA, 3 items, Total: $165.50
The bot parses informal Spanish text, converts units (350gr to 0.35 KG), looks up client-specific prices, and generates order confirmations automatically. The entire ordering system is a single .prompt file with 16 whitelisted functions.
How to set it up:
- 🔧 Install:
pip install keprompt - 📝 Write a
.promptfile: define your model, add.systemand.userturns, end with.exec - Run it against any provider by changing the model name in the header
- 🔒 Add a
.functionswhitelist so the LLM only sees the functions you explicitly allow - Use SQLite-based chat persistence for multi-turn workflows without managing state yourself
Pro tip: The function whitelisting is the most underrated feature here. In production, the LLM only touches what you expose. Jerry’s ordering bot has 16 whitelisted functions and nothing else. That’s how you keep an AI system predictable when real money is moving through it.
KePrompt also tracks costs across providers and logs everything. Around 11K installs already.
🚀 If you’re tired of provider lock-in at the prompt layer, this is worth 20 minutes of your time. GitHub: github.com/JerryWestrick/keprompt
Frequently Asked Questions
Q: Won’t provider differences like tool schemas and safety refusals leak through?
That’s actually the core problem the author is solving. The idea is function whitelisting: your .prompt file explicitly lists which functions the LLM can call, which controls the safety stuff. For deeper differences (like how Claude vs. Gemini interpret the same prompt), KePrompt handles the translation, but yeah, you might need some provider-specific logic occasionally.
Q: Can I really just swap providers by changing one line?
Most of the time, yes – straightforward prompts run unchanged across GPT-4, Claude, and Gemini. Where the providers start acting differently (different interpretations, different safety calls), you might need some fallback logic or variant prompts, but the core idea stays the same.
Q: Is this actually production-ready, or just a proof of concept?
Totally production-ready. The author runs it live for a produce distribution business in Mérida, Mexico – handling Telegram orders in Spanish, converting units, looking up pricing, and creating orders through function calls. The function whitelisting approach adds a security layer too.
Q: How hard is the DSL to learn?
Pretty easy to start. The syntax is super minimal (`.prompt`, `.system`, `.user`, `.exec`), so you can write basic prompts immediately. The more complex stuff (multi-turn conversations, function definitions) adds complexity, but you build it all in one .prompt file – no code switching.
Q: How does cost tracking across providers actually help?
KePrompt logs tokens and cost for each provider, so you can see which one gives you the best bang for your buck on a specific task. Sometimes the cheapest option is best; sometimes you pay more for better quality or speed. Having the numbers makes that trade-off way clearer.
KePrompt – A DSL for prompt engineering across LLM providers
by u/JerryWestrick in PromptEngineering