AI workflows are often tied to specific APIs, making it hard to switch between powerful cloud models (like Claude) and free, private local models (like gpt-oss via Ollama). This lesson demonstrates a powerful and flexible command-line workflow that gives you the best of both worlds.
By combining gomplate for prompt templating with the power of shell pipes, you can direct the same prompt to different AI backends. This allows you to choose the right model for the job—whether you need the raw power of a cloud API or the privacy and cost-savings of a local model—all without changing your core workflow.
The Workflow
This lesson shows you how to:
- Use 
gomplateto render a prompt from a template file. - Pipe the rendered prompt directly to a local model running with 
ollama run <model-name>. - Easily switch the pipeline to send the same prompt to the 
claudeCLI instead. - Use flags like 
--hidethinkingwith Ollama for cleaner output. - Redirect the final AI-generated response into a markdown file for later use.
 
Key Benefits
- Model Agnostic: Seamlessly switch between cloud and local models.
 - Cost-Effective: Use free, local models for development and experimentation.
 - Privacy: Keep sensitive prompts and data on your own machine with local models.
 - Automation: Easily integrate AI generation into your existing shell scripts and workflows.
 
Commands Used
Pipe a templated prompt to a local Ollama model and stream the output (including the "thinking" process).
Pipe a templated prompt to Ollama, hide the thinking process, and redirect the final output to a file.
Remove the generated file.
Pipe the same templated prompt to the Claude CLI and redirect the output to a file.
