<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Sreenath</title>
    <description>The latest articles on Forem by Sreenath (@sreenathmenon).</description>
    <link>https://forem.com/sreenathmenon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1343219%2F374db162-7c2a-447d-9bdb-0f9fa6317ca7.png</url>
      <title>Forem: Sreenath</title>
      <link>https://forem.com/sreenathmenon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sreenathmenon"/>
    <language>en</language>
    <item>
      <title>How to Generate Code in Vim Without Leaving Your Editor (llmswap Tutorial)</title>
      <dc:creator>Sreenath</dc:creator>
      <pubDate>Wed, 10 Sep 2025 17:54:01 +0000</pubDate>
      <link>https://forem.com/sreenathmenon/how-to-generate-code-in-vim-without-leaving-your-editor-llmswap-tutorial-2mpg</link>
      <guid>https://forem.com/sreenathmenon/how-to-generate-code-in-vim-without-leaving-your-editor-llmswap-tutorial-2mpg</guid>
      <description>&lt;p&gt;&lt;em&gt;Complete step-by-step guide to AI-powered code generation directly in vim&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you're a vim user who's tired of constantly switching to ChatGPT, Claude, or other AI tools just to generate a quick function or command, this tutorial is for you.&lt;/p&gt;

&lt;p&gt;By the end of this guide, you'll be generating code directly in your vim buffer without ever leaving your editor.&lt;/p&gt;

&lt;h2&gt;
  
  
  What We're Building
&lt;/h2&gt;

&lt;p&gt;Instead of this workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get stuck on a function&lt;/li&gt;
&lt;li&gt;Alt-tab to ChatGPT&lt;/li&gt;
&lt;li&gt;Ask for help&lt;/li&gt;
&lt;li&gt;Copy the response&lt;/li&gt;
&lt;li&gt;Alt-tab back to vim&lt;/li&gt;
&lt;li&gt;Paste and fix formatting&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You'll do this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Type &lt;code&gt;:r !llmswap generate "what you need"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Code appears at your cursor&lt;/li&gt;
&lt;li&gt;Keep coding&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Vim installed (obviously!)&lt;/li&gt;
&lt;li&gt;Python 3.7+ &lt;/li&gt;
&lt;li&gt;An API key for any LLM provider (OpenAI, Anthropic, Google, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Install llmswap
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;llmswap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. No config files, no complex setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Set Your API Key
&lt;/h2&gt;

&lt;p&gt;Choose your preferred AI provider and set the environment variable:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For OpenAI (GPT-4):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-your-key-here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For Anthropic (Claude):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-ant-your-key-here"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For Google (Gemini):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-gemini-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;For local/free option (Ollama):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# No API key needed, just install Ollama&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OLLAMA_MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"llama2"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this to your &lt;code&gt;.bashrc&lt;/code&gt; or &lt;code&gt;.zshrc&lt;/code&gt; to make it permanent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Test in Terminal First
&lt;/h2&gt;

&lt;p&gt;Before using in vim, test in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"Python function to read CSV file with error handling"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a complete function appear. If not, check your API key setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: The Magic Vim Command
&lt;/h2&gt;

&lt;p&gt;In vim, the &lt;code&gt;:r !&lt;/code&gt; command runs a shell command and inserts its output at your cursor position.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic syntax:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"what you want to generate"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Your First Code Generation
&lt;/h2&gt;

&lt;p&gt;Open vim and try this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a Python file: &lt;code&gt;vim test.py&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Position your cursor where you want the function&lt;/li&gt;
&lt;li&gt;Type: &lt;code&gt;:r !llmswap generate "function to validate email address"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Press Enter&lt;/li&gt;
&lt;li&gt;Watch the code appear!&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Real Examples You Can Try Right Now
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Python Examples
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Generate a class:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Python class for database connection with connection pooling"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generate error handling:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"try-catch block for file operations in Python"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generate API call:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Python function to make HTTP POST request with retry logic"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  JavaScript Examples
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Generate React component:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"React functional component with useState and useEffect"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generate Express middleware:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Express middleware for request logging and authentication"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generate async function:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"JavaScript async function to fetch data from API with error handling"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Configuration Files
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Generate Docker config:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Dockerfile for Node.js application with multi-stage build"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generate nginx config:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"nginx configuration for reverse proxy with SSL"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Generate systemd service:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"systemd service file for Python web application"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Advanced Vim Integration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create Vim Mappings
&lt;/h3&gt;

&lt;p&gt;Add these to your &lt;code&gt;.vimrc&lt;/code&gt; for quick access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="c"&gt;" Generate code with &amp;lt;leader&amp;gt;g&lt;/span&gt;
nnoremap &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;leader&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;g&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate "
&lt;span class="c"&gt;" Generate and explain with &amp;lt;leader&amp;gt;e&lt;/span&gt;
nnoremap &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;leader&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;e&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate "
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can just press &lt;code&gt;&amp;lt;leader&amp;gt;g&lt;/code&gt; and start typing what you need.&lt;/p&gt;

&lt;h3&gt;
  
  
  Language-Specific Generation
&lt;/h3&gt;

&lt;p&gt;Force specific language output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"database connection"&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;&lt;span class="k"&gt;language&lt;/span&gt; &lt;span class="k"&gt;python&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"API endpoint"&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;&lt;span class="k"&gt;language&lt;/span&gt; javascript
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"struct definition"&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;&lt;span class="k"&gt;language&lt;/span&gt; rust
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Save Generated Code to File
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"complete web scraper"&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;save scraper&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;py&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates code and saves it directly to a file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Pro Tips and Tricks
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Be Specific in Your Requests
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Instead of:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"function"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Try:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Python function to parse JSON with nested error handling and logging"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Generate Test Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"pytest unit tests for user authentication function"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Generate Documentation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"docstring for this function"&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;context &lt;span class="s2"&gt;"def calculate_metrics(data, threshold):"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Generate Command Line Scripts
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"bash script to backup PostgreSQL database with compression"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Generate Regular Expressions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"regex to extract email addresses from text"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Database Operations
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;MongoDB queries:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"MongoDB aggregation pipeline to group users by signup date"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;SQL operations:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"PostgreSQL query to find duplicate records in users table"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  DevOps and System Administration
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Docker commands:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"docker-compose file for Python app with Redis and PostgreSQL"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Kubernetes configs:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Kubernetes deployment YAML for Node.js application"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Log analysis:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"awk command to extract error patterns from nginx logs"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Web Development
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;API endpoints:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"FastAPI endpoint with request validation and error handling"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Frontend components:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Vue.js component with props, computed properties, and methods"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Code Doesn't Appear
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Check your API key is set correctly&lt;/li&gt;
&lt;li&gt;Test &lt;code&gt;llmswap generate "hello world"&lt;/code&gt; in terminal first&lt;/li&gt;
&lt;li&gt;Make sure you're using &lt;code&gt;:r !&lt;/code&gt; (not just &lt;code&gt;:!&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Wrong Language Generated
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;--language python&lt;/code&gt; (or your language) to the command&lt;/li&gt;
&lt;li&gt;Be more specific about what you want&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Formatting Issues
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The generated code appears at cursor position&lt;/li&gt;
&lt;li&gt;Use vim's formatting commands (&lt;code&gt;=&lt;/code&gt; key) to fix indentation&lt;/li&gt;
&lt;li&gt;Position cursor at the right indentation level before generating&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  API Errors
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Check your API key hasn't expired&lt;/li&gt;
&lt;li&gt;Make sure you have credits/quota remaining&lt;/li&gt;
&lt;li&gt;Try switching providers: &lt;code&gt;export ANTHROPIC_API_KEY=...&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Changes Everything
&lt;/h2&gt;

&lt;p&gt;Once you get used to this workflow, you'll realize:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No more context switching&lt;/strong&gt; - Stay in the zone&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faster development&lt;/strong&gt; - Generate boilerplate instantly
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learn as you go&lt;/strong&gt; - See different approaches to problems&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-language support&lt;/strong&gt; - Works with any programming language&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provider flexibility&lt;/strong&gt; - Use OpenAI, Claude, Gemini, or local models&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Taking It Further
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Multiple Providers
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Use different providers for different tasks&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;      &lt;span class="c"&gt;# For general coding&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;   &lt;span class="c"&gt;# For complex logic&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;      &lt;span class="c"&gt;# For fast responses&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;llmswap automatically uses the first available key it finds.&lt;/p&gt;

&lt;h3&gt;
  
  
  Local Development with Ollama
&lt;/h3&gt;

&lt;p&gt;For completely offline development:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install Ollama&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://ollama.com/install.sh | sh

&lt;span class="c"&gt;# Pull a model&lt;/span&gt;
ollama pull llama2

&lt;span class="c"&gt;# Use with llmswap&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OLLAMA_MODEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"llama2"&lt;/span&gt;
&lt;span class="c"&gt;# Now llmswap generate works offline!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You now have AI-powered code generation built directly into vim. No more browser tabs, no more copy-paste, no more breaking your flow.&lt;/p&gt;

&lt;p&gt;The key command to remember:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"exactly what you need"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start with simple examples and gradually incorporate it into your workflow. Within a week, you'll wonder how you ever coded without it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Reference
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="c"&gt;" Basic generation&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Python function to read CSV"&lt;/span&gt;

&lt;span class="c"&gt;" With language specification  &lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"API endpoint"&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;&lt;span class="k"&gt;language&lt;/span&gt; javascript

&lt;span class="c"&gt;" Save to file&lt;/span&gt;
&lt;span class="p"&gt;:!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"complete script"&lt;/span&gt; &lt;span class="p"&gt;--&lt;/span&gt;save script&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;py&lt;/span&gt;

&lt;span class="c"&gt;" Get explanation&lt;/span&gt;
&lt;span class="p"&gt;:!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"explain this regex: '^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$'"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/sreenathmmenon/llmswap" rel="noopener noreferrer"&gt;https://github.com/sreenathmmenon/llmswap&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PyPI:&lt;/strong&gt; &lt;a href="https://pypi.org/project/llmswap/" rel="noopener noreferrer"&gt;https://pypi.org/project/llmswap/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation:&lt;/strong&gt; Full provider setup guides in the repo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Try it now:&lt;/strong&gt; Install llmswap and generate your first function in vim. You'll never go back to the old way.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Did this tutorial help you? Give the project a ⭐ on GitHub - every star helps with continued development!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>vim</category>
      <category>tutorial</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
    <item>
      <title>I Finally Stopped Alt-Tabbing to ChatGPT While Coding</title>
      <dc:creator>Sreenath</dc:creator>
      <pubDate>Tue, 09 Sep 2025 17:01:17 +0000</pubDate>
      <link>https://forem.com/sreenathmenon/i-finally-stopped-alt-tabbing-to-chatgpt-while-coding-277l</link>
      <guid>https://forem.com/sreenathmenon/i-finally-stopped-alt-tabbing-to-chatgpt-while-coding-277l</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;Built a terminal command that generates code/commands using any AI provider. No more alt-tabbing to ChatGPT. Works in vim too. &lt;code&gt;pip install llmswap&lt;/code&gt; → &lt;code&gt;llmswap generate "your command"&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;Last Tuesday, I was debugging a Kubernetes cluster at 3 AM. Had vim open with a YAML file that refused to work, ChatGPT open in Chrome, Stack Overflow in another tab, and Claude.ai in a third. The constant alt-tabbing between terminal, ChatGPT, Stack Overflow, and AI assistants was driving me absolutely insane.&lt;/p&gt;

&lt;p&gt;That's when it hit me - why am I leaving my terminal to get help from AI?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Breaking Point
&lt;/h2&gt;

&lt;p&gt;We've all been there. You know that one command exists, but can't remember the exact syntax. Maybe it's that Docker cleanup command, or the specific &lt;code&gt;awk&lt;/code&gt; pattern you need, or how to properly configure nginx for reverse proxy.&lt;/p&gt;

&lt;p&gt;The routine is always the same: switch to browser, search, scroll through results, copy command, switch back to terminal, paste, test, fail, repeat.&lt;/p&gt;

&lt;p&gt;I realized I was doing this dozens of times per day. Every context switch was breaking my flow. Every copy-paste felt like admitting defeat.&lt;/p&gt;

&lt;p&gt;That's when I remembered - &lt;strong&gt;llmswap 4.1.1&lt;/strong&gt; had just shipped with a &lt;code&gt;generate&lt;/code&gt; command. What if I could get AI help without ever leaving my terminal?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Terminal Revolution
&lt;/h2&gt;

&lt;p&gt;Here's what changed everything. Instead of alt-tabbing to ChatGPT, I could just type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"show me all Docker containers eating memory"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And instantly get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker stats &lt;span class="nt"&gt;--no-stream&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt; &lt;span class="s2"&gt;"table &lt;/span&gt;&lt;span class="se"&gt;\t\t&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No browser. No tabs. No context switching. The answer appeared right where I needed it.&lt;/p&gt;

&lt;p&gt;But it gets better. Need to save it to a file?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"backup script for PostgreSQL with rotation"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; backup.sh
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x backup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done. Script created, permissions set, ready to go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Examples from This Week
&lt;/h2&gt;

&lt;p&gt;Let me show you how this actually works in practice. These are real commands I generated this week:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monday morning&lt;/strong&gt;: Client's website was down. Needed to check nginx logs quickly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"find errors in nginx logs from last hour"&lt;/span&gt;
&lt;span class="c"&gt;# Got: tail -f /var/log/nginx/error.log | grep $(date -d '1 hour ago' '+%d/%b/%Y:%H')&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Tuesday&lt;/strong&gt;: Setting up a new Django project. Needed that docker-compose I always forget.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"docker compose for django postgres redis development"&lt;/span&gt; &lt;span class="nt"&gt;--language&lt;/span&gt; yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Perfect 40-line docker-compose.yml appeared. With health checks, volume mounts, everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wednesday&lt;/strong&gt;: Database migration day. Needed to find duplicate emails before adding a unique constraint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"PostgreSQL find duplicate emails in users table"&lt;/span&gt;
&lt;span class="c"&gt;# Got: SELECT email, COUNT(*) FROM users GROUP BY email HAVING COUNT(*) &amp;gt; 1;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Thursday&lt;/strong&gt;: Had to analyze some API logs. That awk command I can never remember.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"extract IP addresses and count from nginx access log"&lt;/span&gt;
&lt;span class="c"&gt;# Got: awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Friday&lt;/strong&gt;: Client needed 100 VMs spun up in OpenStack with delays to avoid overwhelming the API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"script to create 100 VMs in openstack with 30 second delays"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Got a complete bash script with proper batching and error handling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Weekend&lt;/strong&gt;: Emergency debugging session. Needed to grep through compressed log files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"search for error patterns in gzipped log files"&lt;/span&gt;
&lt;span class="c"&gt;# Got: zgrep -i "error\|fail\|exception" /var/log/app/*.gz | head -50&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each time, the answer appeared in seconds. No browser needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  But Wait, It Gets Even Better
&lt;/h2&gt;

&lt;p&gt;Here's where things got really interesting. I discovered you can use this inside vim too.&lt;/p&gt;

&lt;p&gt;Working on a Node.js project, needed rate limiting middleware. Instead of googling and copy-pasting, I typed this inside vim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Express rate limiting middleware"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this appeared directly in my file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rateLimit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;express-rate-limit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;limiter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rateLimit&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;windowMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// 15 minutes&lt;/span&gt;
  &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// limit each IP to 100 requests per windowMs&lt;/span&gt;
  &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Too many requests, please try again later.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;standardHeaders&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;legacyHeaders&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;limiter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I just sat there staring at the screen. The code materialized exactly where my cursor was. No switching. No copying. Just… there.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Vim Integration That Blew My Mind
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;:r !&lt;/code&gt; command in vim reads the output of any shell command directly into your buffer. Combine that with &lt;code&gt;llmswap generate&lt;/code&gt; and you get instant code generation inside your editor.&lt;/p&gt;

&lt;p&gt;Need a MongoDB schema?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"User schema with authentication for MongoDB"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Need nginx config?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"nginx reverse proxy config for Node.js app"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Need a bash script?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"script to backup files older than 30 days"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every time, the code appears right at your cursor. It's like having ChatGPT built into vim, but better - because it works with any LLM provider.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Provider Freedom That Changes Everything
&lt;/h2&gt;

&lt;p&gt;Here's what really gets me excited. While GitHub Copilot locks you into their $10/month subscription and their provider choices, llmswap gives you complete freedom.&lt;/p&gt;

&lt;p&gt;Want to use Claude because it's better at systems programming? Set &lt;code&gt;ANTHROPIC_API_KEY&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Want ultra-fast responses? Use Groq with &lt;code&gt;GROQ_API_KEY&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Want to keep everything local? Run Ollama.&lt;/p&gt;

&lt;p&gt;Already paying for Gemini API? Use that instead of another subscription.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;
llmswap generate &lt;span class="s2"&gt;"whatever you need"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same command, different AI behind it. Your choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  My New Daily Workflow
&lt;/h2&gt;

&lt;p&gt;This is how I work now:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Morning system check&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"check system health on Ubuntu server"&lt;/span&gt;
&lt;span class="c"&gt;# Gets me: df -h; free -m; uptime; systemctl --failed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Database work&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"MySQL show slow queries from last hour"&lt;/span&gt;
&lt;span class="c"&gt;# Gets me: mysqldumpslow -t 10 /var/log/mysql/slow.log&lt;/span&gt;

llmswap generate &lt;span class="s2"&gt;"MongoDB create user with read and write privileges"&lt;/span&gt;
&lt;span class="c"&gt;# Gets me: mongo admin --eval 'db.createUser({user:"appuser",pwd:"password",roles:[{role:"readWrite",db:"myapp"}]})'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Git operations&lt;/strong&gt; (because I always forget):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"git remove file from history completely"&lt;/span&gt;
&lt;span class="c"&gt;# Gets me: git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch file.txt'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Quick scripts in vim&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Python function to read CSV with error handling"&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"JavaScript debounce function"&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"Bash script to rotate logs"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Unexpected Use Cases
&lt;/h2&gt;

&lt;p&gt;I started using it for everything. Literally everything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS operations&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"AWS CLI list all EC2 instances with names and IPs"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Kubernetes debugging&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"kubectl commands to debug failing pod"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Performance analysis&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"find which process is using most CPU"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Security checks&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"check for failed SSH attempts in system logs"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Network debugging&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"test if port 443 is open on remote server"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even configuration files. Need a systemd service?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"systemd service file for Python web app"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; myapp.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The answer is always there, in seconds, right in your terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters More Than You Think
&lt;/h2&gt;

&lt;p&gt;Let's talk numbers. GitHub Copilot costs $10/month per developer. For a team of 10 developers, that's $1,200/year.&lt;/p&gt;

&lt;p&gt;With llmswap:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Gemini: Costs 96% less than GPT-4&lt;/li&gt;
&lt;li&gt;Use Ollama: Completely free, runs locally&lt;/li&gt;
&lt;li&gt;Use whatever API access you already have&lt;/li&gt;
&lt;li&gt;No subscriptions, no vendor lock-in&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But it's not just about money. It's about choice. Maybe you want IBM Watson for enterprise features. Maybe you want Groq for speed. Maybe you want everything local with Ollama.&lt;/p&gt;

&lt;p&gt;Your terminal, your AI, your choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup (Embarrassingly Simple)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;llmswap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set one environment variable for your preferred provider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt; &lt;span class="c"&gt;# Or any other provider&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Start generating:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"your first command"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I Realized
&lt;/h2&gt;

&lt;p&gt;I haven't opened ChatGPT in my browser for three weeks. My terminal became my AI assistant.&lt;/p&gt;

&lt;p&gt;Think about your daily workflow. How many times do you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ask ChatGPT for a command you've forgotten&lt;/li&gt;
&lt;li&gt;Search Stack Overflow for syntax&lt;/li&gt;
&lt;li&gt;Switch to Claude for code explanations&lt;/li&gt;
&lt;li&gt;Jump to Gemini for a different perspective&lt;/li&gt;
&lt;li&gt;Copy-paste from documentation sites&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What if you never had to leave your terminal again?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Test
&lt;/h2&gt;

&lt;p&gt;Last Friday, I was setting up monitoring for a client. Needed Prometheus, Grafana, alertmanager - the whole stack. Instead of hunting through documentation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"docker compose for Prometheus Grafana monitoring stack"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; monitoring.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Got a complete 80-line docker-compose file with proper networking, volumes, and health checks. Launched it, configured alerts, done.&lt;/p&gt;

&lt;p&gt;What used to take 2 hours took 20 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try This Right Now
&lt;/h2&gt;

&lt;p&gt;If you're in your terminal, try this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"The current time is: &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See how the command output appears? Now imagine that with any code you need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;llmswap generate &lt;span class="s2"&gt;"function to validate email addresses in Python"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or in vim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;date
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See how it inserts into your file? Now try:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight viml"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="k"&gt;r&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;llmswap generate &lt;span class="s2"&gt;"that regex you always forget"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Future is Here
&lt;/h2&gt;

&lt;p&gt;We're developers. We live in terminals. Our AI assistants should live there too.&lt;/p&gt;

&lt;p&gt;Every alt-tab breaks focus. Every context switch costs time. Every copy-paste is friction.&lt;/p&gt;

&lt;p&gt;This shipped in &lt;strong&gt;&lt;em&gt;llmswap 4.1.1&lt;/em&gt;&lt;/strong&gt; last week. It's already changed how I write code.&lt;/p&gt;

&lt;p&gt;The best part? It's not replacing your thinking - it's eliminating the friction between your thoughts and your code.&lt;/p&gt;

&lt;p&gt;Your terminal is waiting. Your AI assistant is one &lt;code&gt;pip install&lt;/code&gt; away.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;llmswap
llmswap generate &lt;span class="s2"&gt;"the command you always google"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Welcome to coding without context switching.&lt;/p&gt;




&lt;h2&gt;
  
  
  Links:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Setup&lt;/strong&gt;: Just set one API key for your preferred provider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;ANTHROPIC_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-..."&lt;/span&gt; &lt;span class="c"&gt;# For Claude&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"sk-..."&lt;/span&gt; &lt;span class="c"&gt;# For GPT-4&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;GEMINI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt; &lt;span class="c"&gt;# For Google Gemini&lt;/span&gt;
&lt;span class="c"&gt;# ... or any of the 8 supported providers&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⭐ &lt;a href="https://github.com/sreenathmenon/llmswap" rel="noopener noreferrer"&gt;Star the project on GitHub&lt;/a&gt; if it saves you time - every star motivates continued development! ⭐&lt;/p&gt;




&lt;p&gt;This is part 2 of my llmswap series. Read &lt;a href="https://sreenathmenon.com/blog/2025-08-30-hackathon-to-open-source-llmswap/" rel="noopener noreferrer"&gt;part 1: From Hackathon to Open Source&lt;/a&gt; to see how llmswap was born.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;What's your biggest context-switching pain point when coding? Drop your thoughts in the comments!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>terminal</category>
      <category>opensource</category>
    </item>
    <item>
      <title>How a Hackathon Rejection Became 6,000+ PyPI Downloads</title>
      <dc:creator>Sreenath</dc:creator>
      <pubDate>Wed, 03 Sep 2025 16:12:06 +0000</pubDate>
      <link>https://forem.com/sreenathmenon/how-a-hackathon-rejection-became-6000-pypi-downloads-445p</link>
      <guid>https://forem.com/sreenathmenon/how-a-hackathon-rejection-became-6000-pypi-downloads-445p</guid>
      <description>&lt;p&gt;I was working on a hackathon project - an AI assistant that lets you chat with your infrastructure using RAG + MCP. Think of it as a live conversation with your entire cloud setup.&lt;/p&gt;

&lt;p&gt;We built support for multiple LLM providers - Gemini, Watsonx, and Ollama. The switching logic was there, but embedded deep in the project code.&lt;/p&gt;

&lt;p&gt;Then I came across &lt;a href="https://venturebeat.com/ai/ibm-sees-enterprise-customers-are-using-everything-when-it-comes-to-ai-the-challenge-is-matching-the-llm-to-the-right-use-case/" rel="noopener noreferrer"&gt;this VentureBeat article&lt;/a&gt; where Armand Ruiz, IBM's AI VP, discussed how enterprise customers use multiple AI providers -&lt;br&gt;
"&lt;em&gt;&lt;strong&gt;the challenge is matching the LLM to the right use case&lt;/strong&gt;&lt;/em&gt;." That validated what we were building.&lt;/p&gt;

&lt;p&gt;During the hackathon, we implemented a config system where users could specify different providers and models, pass API keys through config files or environment variables, and set a default provider. It worked well for our use case.&lt;/p&gt;

&lt;p&gt;By the hackathon submission deadline, we supported Anthropic, Gemini, Watsonx, and Ollama. Same app, different brains.&lt;/p&gt;

&lt;p&gt;We didn't make the shortlist. But I wasn't ready to end the story there and kept improving what I had in control.&lt;/p&gt;

&lt;p&gt;I realized we had built something valuable - this provider-switching logic buried in our codebase was solving a real problem. So I extracted it, restructured it properly, added more providers and CLI tools, and open-sourced it as &lt;strong&gt;llmswap&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Instead of this mess in every project
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;openai&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;anthropic&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;anthropic&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Anthropic&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# ... repeat for 7 providers
&lt;/span&gt;
&lt;span class="c1"&gt;# Just this
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;llmswap&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LLMSwap&lt;/span&gt;
&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LLMSwap&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Reads from config or env vars
&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Your question&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The extracted version is much cleaner than what we had in the hackathon.&lt;br&gt;
Plus, I added CLI tools that became my daily workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Quick infrastructure questions&lt;/span&gt;
llmswap ask &lt;span class="s2"&gt;"Which logs should I check to debug Nova VM creation failure?"&lt;/span&gt;

&lt;span class="c"&gt;# Interactive troubleshooting&lt;/span&gt;
llmswap chat

&lt;span class="c"&gt;# Debug OpenStack errors&lt;/span&gt;
llmswap debug &lt;span class="nt"&gt;--error&lt;/span&gt; &lt;span class="s2"&gt;"QuotaPoolLimit:"&lt;/span&gt;

&lt;span class="c"&gt;# Review infrastructure code&lt;/span&gt;
llmswap review heat_template.yaml &lt;span class="nt"&gt;--focus&lt;/span&gt; security
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;These CLI tools alone save us 10+ ChatGPT tab switches daily.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6,000+ downloads on PyPI in the first month.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes your best open source contributions come from recognizing the valuable pieces in larger projects. What started as embedded hackathon code became a tool helping thousands of developers.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;PyPI: &lt;a href="https://pypi.org/project/llmswap/" rel="noopener noreferrer"&gt;https://pypi.org/project/llmswap/&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  Update (Sept 5, 2024): v4.0.0 Released! 🚀
&lt;/h4&gt;

&lt;p&gt;I just shipped v4.0.0:&lt;/p&gt;

&lt;p&gt;What's New:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cost Analytics - Compare real costs across OpenAI, Claude, Gemini, IBM Watsonx, and Ollama&lt;/li&gt;
&lt;li&gt;Usage Tracking - See exactly where your AI budget goes&lt;/li&gt;
&lt;li&gt;50-90% Savings - Intelligent caching + provider optimisation&lt;/li&gt;
&lt;li&gt;Privacy First - Your prompts are never stored, only metadata's&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The journey continues! &lt;a href="https://github.com/sreenathmmenon/llmswap" rel="noopener noreferrer"&gt;Check out the new features&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>opensource</category>
      <category>ai</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
