Zed Model Management

Master the art of managing AI models in Zed

Efficiency, Cost Control, and Precision

Back to Model Use

Zed's assistant panel is your gateway to a lineup of LLMs, ready to tackle everything from quick fixes to epic refactors. Here's who's on deck as of March 29, 2025:

  • Claude 3.5 Sonnet: Anthropic's brainchild—sharp, thoughtful, and a 128k-token beast for reasoning through gnarly code.
  • GPT-4o: OpenAI's all-star—fast, creative, and versatile, also rocking 128k tokens.
  • o1-preview: OpenAI's reasoning titan—slower but surgical, perfect for edge-case crunching (context varies, but hefty).
  • LM Studio Models: Local heroes like Llama 3.1—run 'em on your rig, free and limitless.
  • Zeta: Zed's open-source wildcard—light, predictive, and built for speed.

Find these in Settings > Assistant (hit Cmd + , on macOS or Ctrl + , on Linux/Windows Insiders). It's your control hub—models, providers, and configs, all laid out clean and simple.

Dev Hack: Posts on X rave about Zed's v0.170 LM Studio integration (January '25). It's a game-changer for local model fans—keep reading to wire it up!

Zed's got two killer zones for AI action: the Assistant Panel (your chatty collaborator) and Inline Transformations (code edits on the fly). Let's match models to missions.

Assistant Panel: Your AI Code Buddy

  • Where: Right-side panel, Assistant icon (or Cmd + T then "Assistant").
  • How: Pick your model from the dropdown above the input box—Claude, GPT, whatever's hot.
  • Playbook:
    • Claude 3.5 Sonnet: Debugging a hairy Rust borrow checker mess? Feed it your file with /file src/main.rs—it'll reason through ownership like a champ.
    • GPT-4o: Need a quick Express.js server? Type "Spin up a Node REST API"—it'll churn out a full scaffold, swagger included.
    • o1-preview: Optimizing a graph traversal? Ask "Refine this BFS for sparse graphs"—it's slow but gold.
    • LM Studio (e.g., Llama 3.1): Offline grinding? Same prompt, zero cloud cost.
  • Tech Bit: The panel's a full editor—every prompt, response, and context (code snippets, files) is raw text you can tweak. Slash commands like /file or /project pull in context—more on that soon.

Inline Transformations: Code Surgery

  • Where: Highlight code, hit Cmd + Shift + A (or right-click > "Transform with Assistant").
  • How: Model choice mirrors your Assistant default—set it once, roll with it.
  • Playbook:
    • Zeta: Quick docstring? Highlight a function, type "Add docs"—it's lightweight and instant.
    • Claude 3.5 Sonnet: Refactoring a Python mess into classes? "Rewrite as OOP"—it'll nail inheritance and encapsulation.
    • GPT-4o: Converting JS to TS? "Type this up"—types flow like magic.
  • Tech Bit: Inline pulls context from your selection + open buffers. Token limits apply (e.g., 128k for Claude), so keep highlights tight for efficiency.

Zed's free tier hooks you up with Claude 3.5 Sonnet and GPT-4o—plenty of juice, but finite prompts (exact limits shift; check Settings > Subscription). Paid plans (Individual, Pro) bump you to 500+ prompts/month. Here's how to keep the meter low:

Default to Zeta

  • Why: Zed's homebrew model is free, unlimited, and tuned for speed.
  • How: Set it as your default in Settings > Assistant > Default Model > "Zeta."
    • Quick completions: "Finish this loop."
    • Predictive edits: It guesses your next move (toggle in Settings > Features > Edit Prediction).
  • Tech Bit: Zeta's lean—think 8k tokens vs. Claude's 128k. Perfect for small fries, less so for codebase-wide refactors.

Batch Your Brilliance

  • Why: Every Assistant message or inline transform burns a prompt.
  • How: Bundle asks:
    • Instead of:
      • Assistant: "Write a fetch call."
      • Assistant: "Add error handling."
    • Do:
      • Assistant: "Write a fetch call with error handling."
  • Tech Bit: One API hit, one prompt. Token count rises, but you're saving credits.

Slash Command Smarts

  • Why: Context is king—feed it right, avoid follow-ups.
  • How: Use built-ins:
    • /file src/app.py—drops a file into the convo.
    • /project—grabs repo-wide context (beta, enable in Settings > Experimental).
    • /auto (coming soon)—auto-inserts task-relevant code.
  • Tech Bit: Slash commands embed text directly into the prompt buffer—visible, editable, and token-efficient.

Zed's v0.170 (January '25) unleashed LM Studio integration—run models like Llama 3.1 locally, dodge cloud limits, and code off-grid. Here's the setup:

Wire It Up

  • How:
    1. Grab LM Studio (lmstudio.ai), install it.
    2. Download a model—Llama 3.1 8B's a lightweight starter (4GB RAM minimum).
    3. Fire up the server: lms server start in your terminal.
    4. In Zed: Settings > Assistant > Providers > Add "LM Studio."
      • API URL: http://localhost:1234/v1 (default).
      • Model: llama3.1:8b (or your pick).
    5. Set it as default or pick it in the Assistant dropdown.
  • Why: Free, unlimited prompts—your hardware's the limit.
  • Tech Bit: LM Studio mimics OpenAI's API spec—Zed talks to it seamlessly. GPU acceleration (NVIDIA CUDA) slashes latency if you've got the gear.

Use Case

  • Prompt: "Write a Go CLI with flags."
  • Llama 3.1 churns out:
    package main
    import "flag"
    
    func main() {
        name := flag.String("name", "world", "a name to greet")
        flag.Parse()
        fmt.Printf("Hello, %s!\n", *name)
    }
  • No cloud, no cost—just your rig's horsepower.

Zed's all about control—tweak it to your dev soul:

Prompt Library

  • How: Assistant Panel > "Prompts" tab > Add new.
    • Example: "You're a Python expert. Write concise, PEP 8 code."
    • Save, reuse with /prompt my-python-style.
  • Tech Bit: Prompts prepend to every request—consistent output, fewer tweaks.

Settings.json Magic

  • How: Cmd + , > "Open Settings" > Edit settings.json.
  • Example:
    {
      "assistant": {
        "default_model": {
          "provider": "lm_studio",
          "model": "llama3.1:8b"
        },
        "version": "2"
      },
      "inlay_hints": { "enabled": true }
    }
  • Why: Locks your default model, tunes extras like inlay hints for LSP+AI synergy.

Debug Like a Boss

  • How: Cmd + Shift + P > "Open Log"—see model requests, token counts.
  • Tech Bit: Logs reveal API payloads—spot token hogs or misfires, refine prompts.

There you have it, dev dynamo! You're now slinging models in Zed like a seasoned vet—Zeta for speed, Claude for depth, GPT-4o for flair, and LM Studio for that local edge. Batch your prompts, slash your context, and tweak your setup to keep the AI humming.