DOCS

Everything you need to install Code Pirate, configure your first API key, and start coding without a middleman.

Installation

Step 1 — Install the extension

From the VS Code Marketplace (recommended): Search for Code Pirate in the Extensions sidebar and click Install. Automatic updates included.

From a .vsix file (for SSH Remote, Cursor, or offline environments):

  1. Open VS Code
  2. Go to the Extensions sidebar → menu (top-right) → Install from VSIX…
  3. Select the downloaded .vsix file
  4. Reload VS Code when prompted

Step 2 — Add Your API Key

On first install, Code Pirate automatically opens the setup wizard. If it doesn’t appear, run it manually:

Command Palette Ctrl+Shift+P / Cmd+Shift+PCode Pirate: Set Up API Key

The wizard walks you through:

  1. Choose a provider — OpenRouter, Anthropic Direct, Groq, Mistral, Gemini, Together AI, Ollama, LM Studio, or a custom OpenAI-compatible endpoint
  2. Enter your API key — stored encrypted in VS Code’s SecretStorage (never transmitted to CodePirate.cc)
  3. Done — the sidebar opens automatically

Where to get an API key

  • OpenRouterRecommended. Access 200+ models through one key. Free tier available.
  • Anthropic — Direct access to Claude models
  • Groq — Fast inference, free tier available
  • Mistral — European provider
  • Google AI Studio — Gemini models
  • Ollama / LM Studio — No key required. Runs fully offline.

Step 3 — Open Code Pirate

Code Pirate lives in the Secondary Side Bar (right side) — the same panel where Copilot sits. If it’s not visible:

Command Palette Code Pirate: Open Sidebar

You can drag it to any panel in VS Code. The layout is yours to keep.

Provider & Model Selector

At the top of the sidebar, two controls:

  • Provider dropdown — switch between all configured providers instantly
  • Model search — type to filter. For OpenRouter, this searches all 200+ models in real time with name, price per 1k tokens, and context length. For other providers, a curated list is shown.

Chat — Lead Architect Mode

The main chat interface. Type a message and press Enter.

What to ask:

  • Architecture decisions: “How should I structure authentication in this app?”
  • Code generation: “Add a rate limiter to the Express router”
  • Explain code: “Walk me through what this function does”
  • Refactors: “Rewrite this to be more idiomatic TypeScript”

@workspace context: Toggle the @workspace checkbox to include your full codebase. Code Pirate indexes your project files and injects the most relevant ones, token-weighted.

Thinking Budget Dial: Five positions — Off, Low, Medium, High, Max. Controls how much reasoning the model does. Higher = better answers, higher cost, more latency.

Personas:

  • Lead Architect — Default. Full system prompt for architectural decisions and code generation.
  • Diff Agent — Focused on producing clean, reviewable file changes.
  • Snippet Engine — Short, precise code completions and one-liners.

Multi-File Diff & Apply

When Code Pirate’s response includes file changes, a diff bar appears at the bottom of the chat showing how many files were modified.

  • Preview — Opens a side-by-side diff for each changed file. Review every line before anything touches your codebase.
  • Apply All — Writes changes to disk
  • Reject — Discards pending changes

Ghost Diff checks file modification times before writing. If you’ve manually edited a file after the AI response, it will not silently overwrite your work.

Captain’s Ledger

The cost tracker in the sidebar footer shows:

  • Input tokens used this session
  • Output tokens generated
  • Actual cost in USD (from the model’s published pricing)

Prompt caching is applied automatically where supported (Anthropic, OpenRouter). Cache hits appear as reduced costs in the Ledger.

Blueprint Vault

A local library of saved prompt templates. Store project-specific instructions, frequently used prompts, or system prompt fragments you mix into chats.

  • To save: Click Save to Vault in the Vault tab, give it a name, paste the content.
  • To use: Select a vault entry — it’s automatically included in your next chat as additional context.

Command Palette Commands

All commands: Ctrl+Shift+P / Cmd+Shift+P

CommandDescription
Code Pirate: Open SidebarOpens the Code Pirate panel
Code Pirate: Set Up API KeyRe-runs the setup wizard — change provider or update key
Code Pirate: Inline ChatOpens inline chat at cursor (Ctrl+I / Cmd+I)
Code Pirate: Explain Terminal ErrorPastes last terminal error into chat and asks for fix
Code Pirate: Generate Commit MessageReads staged git diff and writes a commit message
Code Pirate: Generate .projectrulesWizard that interviews you about your stack and generates a .projectrules file
Code Pirate: Activate LicenseEnter a Pro license key
Code Pirate: Run DiagnosticsSelf-test, opens report in Output panel. Also writes /tmp/codepirate-diagnostics.json

Keyboard shortcut: Ctrl+I / Cmd+I — Inline chat at cursor (when editor is focused)

Inline Ghost Text Completions

Code Pirate provides inline ghost text completions as you type — the same tab-completion experience as Copilot, running on your own API key with no daily cap.

Tips:

  • Use a fast, cheap model for completions (e.g. claude-haiku-3-5, llama-3.1-8b-instant) — set it as your active model during heavy editing sessions
  • Use a powerful model for chat (e.g. claude-opus-4-5, gpt-4o) — switch in the model selector

.projectrules Support

Code Pirate automatically detects and injects your project instructions file into every chat as system context. Supported files (checked in priority order):

  1. .projectrules — Code Pirate native
  2. .github/copilot-instructions.md — Copilot users, zero migration friction
  3. .cursorrules — Cursor users

Generate one from scratch:

Command Palette Code Pirate: Generate .projectrules

A guided wizard interviews you about your stack, conventions, and preferences and writes the file automatically.

Supported Providers

ProviderTypeNotes
OpenRouterCloud200+ models via one key — recommended for most users
Anthropic DirectCloudDirect Claude access. Different request schema, handled automatically.
GroqCloudFast inference; free tier available
MistralCloudEuropean provider
Google GeminiCloudGemini 2.5 Pro/Flash
Together AICloudOpen model hosting
OllamaLocalNo key required; fully offline
LM StudioLocalNo key required; fully offline
Custom endpointAnyAny OpenAI-compatible API — enter the URL manually

Endpoints are pre-filled automatically for each provider. The only manual entry needed is your API key.

Troubleshooting

Sidebar is blank or shows “Loading…”

Run Code Pirate: Run Diagnostics from the Command Palette. Common causes:

  • Extension just installed and hasn’t fully activated — try Reload Window
  • API key not yet entered — run Code Pirate: Set Up API Key

Diagnostics shows ⚠ “API key stored: No key”

The setup wizard didn’t complete or the key didn’t save. Run Code Pirate: Set Up API Key to re-enter it.

Running on VS Code Remote (SSH, containers, WSL)

Fully supported. Code Pirate uses an IIFE-format webview bundle specifically to work in SSH Remote environments where ES module scripts are blocked. If something isn’t working, run diagnostics — the report includes your Remote kind and will flag any asset loading issues.

Chat sends but no response arrives

Check the Captain’s Ledger. If input tokens are counting up but output is empty, the provider API responded with an error — it will appear in the chat. Verify your API key is valid and has credits.

Still stuck?

Open an issue on the GitHub repository with your diagnostics report attached. We’re actively watching.

Ready? Download and go.

No account. No middleman. 30 seconds to first completion.