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):
- Open VS Code
- Go to the Extensions sidebar →
⋯menu (top-right) → Install from VSIX… - Select the downloaded
.vsixfile - 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:
Ctrl+Shift+P / Cmd+Shift+P → Code Pirate: Set Up API Key
The wizard walks you through:
- Choose a provider — OpenRouter, Anthropic Direct, Groq, Mistral, Gemini, Together AI, Ollama, LM Studio, or a custom OpenAI-compatible endpoint
- Enter your API key — stored encrypted in VS Code’s
SecretStorage(never transmitted to CodePirate.cc) - Done — the sidebar opens automatically
Where to get an API key
- OpenRouter — Recommended. 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.
The Sidebar
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:
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
| Command | Description |
|---|---|
Code Pirate: Open Sidebar | Opens the Code Pirate panel |
Code Pirate: Set Up API Key | Re-runs the setup wizard — change provider or update key |
Code Pirate: Inline Chat | Opens inline chat at cursor (Ctrl+I / Cmd+I) |
Code Pirate: Explain Terminal Error | Pastes last terminal error into chat and asks for fix |
Code Pirate: Generate Commit Message | Reads staged git diff and writes a commit message |
Code Pirate: Generate .projectrules | Wizard that interviews you about your stack and generates a .projectrules file |
Code Pirate: Activate License | Enter a Pro license key |
Code Pirate: Run Diagnostics | Self-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):
.projectrules— Code Pirate native.github/copilot-instructions.md— Copilot users, zero migration friction.cursorrules— Cursor users
Generate one from scratch:
A guided wizard interviews you about your stack, conventions, and preferences and writes the file automatically.
Supported Providers
| Provider | Type | Notes |
|---|---|---|
| OpenRouter | Cloud | 200+ models via one key — recommended for most users |
| Anthropic Direct | Cloud | Direct Claude access. Different request schema, handled automatically. |
| Groq | Cloud | Fast inference; free tier available |
| Mistral | Cloud | European provider |
| Google Gemini | Cloud | Gemini 2.5 Pro/Flash |
| Together AI | Cloud | Open model hosting |
| Ollama | Local | No key required; fully offline |
| LM Studio | Local | No key required; fully offline |
| Custom endpoint | Any | Any 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.