Multi-Provider LLM Client + Agent Framework for Clojure
Switch transparently between Ollama, ChatGPT, Claude, DeepSeek, and OpenRouter. Chain LLM calls with declarative workflows.
Related blog posts
Watch the demo: Native binary CLI with streaming, vision analysis, image generation, and auto-pull features.
(require '[pyjama.core :as p])
(p/ollama "http://localhost:11434" :generate
{:prompt "Explain Clojure in one sentence"})Interactive Chat:
# Start chat with default model (llama3.2)
clj -M:ollama
# Specify a different model
clj -M:ollama -m llama3.1
# Use a remote Ollama server
clj -M:ollama -m qwen2.5 -u http://192.168.1.100:11434Image Generation:
# Generate image (auto-detects by .png extension)
clj -M -m pyjama.cli.ollama -o sunset.png -p "Beautiful sunset over ocean"
# Custom size
clj -M -m pyjama.cli.ollama -o art.png -w 1920 -g 1080 -p "Cyberpunk city"
# Save text to markdown
clj -M -m pyjama.cli.ollama -m llama3.2 -o response.md -p "Explain Clojure"Native Binary (instant startup, standalone):
# Build once (~2 minutes)
clj -M:native-cli
# Use anywhere
./pyjama -o image.png -w 512 -g 512 -p "A robot"
./pyjama -m llama3.2 -o doc.md -p "Explain macros"π Full Ollama Documentation - Chat, image generation, vision models, native binary, and more
(require '[pyjama.openai :as openai])
(openai/chatgpt
{:messages [{:role "user" :content "Explain Clojure"}]})Interactive Chat (Any Provider):
# ChatGPT (default)
clj -M:llm
# Claude
clj -M:llm -l claude
# DeepSeek
clj -M:llm -l deepseek
# Gemini
clj -M:llm -l gemini
# OpenRouter
clj -M:llm -l openrouter -m anthropic/claude-3.5-sonnetSecrets loaded automatically from ~/.secrets/secrets.edn or Vault.
Same simple interface - just swap the provider. See docs/EXAMPLES.md for all providers.
Want to chain multiple LLM calls? The Agent Framework lets you dynamically route between providers and steps.
{:my-agent
{:start :analyze
:steps
{:analyze
{:prompt "Analyze: {{ctx.input}}. Return: positive/negative/neutral"
:next :route}
:route
{:routes [{:when [:= [:obs] "positive"] :next :celebrate}
{:when [:= [:obs] "negative"] :next :sympathize}]
:next :neutral-response}}}}Run it:
clj -M -m pyjama.cli.agent run my-agent '{"input": "I love Clojure!"}'- Chaining - Research workflow with 5 LLM calls β examples/chaining-llms.edn
- Routing - Sentiment-based responses β examples/routing-agents.edn
- Loops - Batch processing β examples/simple-loop-demo.edn
Full documentation: docs/LOOP_SUPPORT.md
Monitor running agents with interactive Mermaid diagrams:
clj -M -m pyjama.agent.hooks.dashboard
open http://localhost:8090Full guide: docs/DASHBOARD.md
Secure API credentials with the Secrets Library (100% open source):
(require '[secrets.core :as secrets])
;; Get secrets in your agents
(secrets/get-secret [:openai :api-key]) ; => "sk-..."
(secrets/get-secret [:gitlab :token]) ; => "glpat-..."File-based (secrets.edn):
{:openai {:api-key "sk-..."}
:gitlab {:token "glpat-..." :url "https://gitlab.com"}}Vault integration (open source):
(vault/read-secret config "secret" "pyjama/openai")
;; => {:api-key "sk-..."}Environment-aware staging/production separation.
π Full Documentation | Quick Start
Full-stack example agents demonstrating Pyjama's capabilities:
AI image generation with Ollama's Z-Image Turbo model. Full-stack ClojureScript app with real-time progress tracking and beautiful UI.
- Text-to-image generation
- Real-time HTTP polling
- Custom dimensions (128Γ128 to 2048Γ2048)
- Modern gradient UI
π¬ Movie Review Agent
AI-powered movie analysis using TMDB API. CLI and web UI modes.
- TMDB API integration
- LLM-powered reviews
- Plot summaries & recommendations
- Web UI + CLI modes
π§ Email Agents
Email automation with pure EDN (no Clojure code!). Watcher and sender agents.
- Email monitoring with batch processing
- LLM email composition
- IMAP/SMTP integration
- Declarative loops
More showcases: pyjama-agent-showcases
- Unified LLM Chat - Interactive CLI for any LLM provider (ChatGPT, Claude, DeepSeek, Gemini, OpenRouter)
- Ollama Interactive Chat - Interactive CLI chat with local Ollama models
- Dashboard - Real-time agent monitoring and visualization
- Secrets Management - File-based and Vault secret storage
- Shell and Cron Tools - Execute commands and schedule tasks
- Agent Examples - EDN files showing chaining, routing, loops
- chaining-llms.edn - Chain multiple LLM calls
- routing-agents.edn - Route based on LLM results
- simple-loop-demo.edn - Batch processing
- system-monitor-example.edn - Shell and cron tools demo
- API Examples - Comprehensive Ollama/ChatGPT examples
- Loop Support - Detailed loop documentation
- Changelog - Release history
; deps.edn
{:deps {hellonico/pyjama {:git/url "https://github.com/hellonico/pyjama"
:git/tag "v0.3.0"
:git/sha "78b0c77"}}}Copyright Β© 2024-2026 hellonico
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.
