A headless macOS AI application that refines selected text using OpenAI-compatible LLM services via a customizable global keyboard shortcut.
- Headless Operation: Runs silently in the menu bar with custom app icon
- Multiple Refinement Cards: Create multiple cards, each with its own prompt and keyboard shortcut
- Visual Feedback: Floating loading indicator follows your cursor while refining
- OpenAI-Compatible: Works with OpenAI, Anthropic, local LLMs, or any OpenAI-compatible API
- Configurable Base URL: Connect to any OpenAI-compatible endpoint
- Test Connection: Built-in connection testing to verify your API setup
- Fully Customizable: Configure API endpoint, model, and multiple refinement presets
- Native macOS: Built with SwiftUI for a seamless Mac experience
- Create one or more refinement cards (each with a prompt and keyboard shortcut)
- Select any text in any application
- Press the shortcut for your desired refinement style
- A loading indicator appears near your cursor showing progress
- SeaCrab captures the text, sends it to your LLM with the card's prompt
- The refined text automatically replaces your selection
open SeaCrab.xcodeproj
# Build and run from Xcode (βR)When you first run SeaCrab, you'll be prompted to grant accessibility permissions:
- Open System Settings β Privacy & Security β Accessibility
- Enable SeaCrab in the list
- Restart SeaCrab if needed
- Click the SeaCrab icon (β¨) in your menu bar
- Select Settings...
- Configure your API connection:
- Base URL: OpenAI-compatible API endpoint
- API Key: Your API key
- Model: Model name to use
- Click Test Connection to verify your setup
- Create refinement cards:
- Each card has a name, prompt, and keyboard shortcut
- Default card:
Control + Rfor general refinement - Click + Add New Refinement Card to create more presets
- Example: Create a "Grammar Only" card with
Control + Shift + R
OpenAI
- Base URL:
https://api.openai.com/v1 - Model:
gpt-4o,gpt-4o-mini,gpt-3.5-turbo - Get your API key: platform.openai.com
Anthropic (via OpenAI-compatible endpoint)
- Use a proxy like OpenRouter or similar
- Base URL:
https://openrouter.ai/api/v1 - Model:
anthropic/claude-3-5-sonnet,anthropic/claude-3-opus - Get your API key: openrouter.ai
Local LLM (LM Studio)
- Base URL:
http://localhost:1234/v1 - Model: Your local model name (e.g.,
llama-3.2-3b) - API Key: Can be empty or any value
Local LLM (Ollama with OpenAI compatibility)
- Base URL:
http://localhost:11434/v1 - Model: Your Ollama model name
- API Key: Can be empty or any value
- Set up one or more refinement cards with different prompts and shortcuts
- Select text in any application (TextEdit, Safari, Slack, etc.)
- Press the shortcut for your desired refinement (e.g.,
Control + Rfor general refinement) - A floating "Rewriting..." indicator appears and follows your cursor
- Move your cursor freely - the indicator stays with you
- Wait for the refinement to complete
- Your text is automatically replaced with the refined version
All settings are saved automatically as you type. A checkmark indicator confirms when changes are saved.
Base URL: OpenAI-compatible API endpoint
- Default:
https://api.openai.com/v1 - Format: Full URL with
https://prefix (e.g.,https://api.openai.com/v1) - The app automatically extracts the hostname and path for the SDK
- Works with any OpenAI-compatible service
- Auto-saved on change
API Key: Your API authentication key
- Stored securely in UserDefaults
- Auto-saved on change
Model: Model identifier
- Default:
gpt-4o - Can be any model supported by your endpoint
- Auto-saved on change
Refinement Cards: Multiple preset configurations
- Each card combines:
- Name: Descriptive label (e.g., "Grammar Only", "Make Professional")
- Prompt: Custom system prompt for refinement
- Keyboard Shortcut: Unique global shortcut for this card
- Default card uses
Control + Rfor general refinement - Create multiple cards for different refinement styles:
Control + R: General refinementControl + Shift + R: Grammar and spelling onlyControl + Option + R: Make conciseControl + Command + R: Professional tone
- All changes auto-saved
- Minimum 1 card required (can't delete the last card)
SeaCrab/
βββ Models/
β βββ AppSettings.swift # Settings management with UserDefaults
β βββ RefinementCard.swift # Card model (prompt + shortcut)
βββ Services/
β βββ LLMService.swift # OpenAI-compatible API integration
β βββ KeyboardShortcutMonitor.swift # Multi-shortcut monitoring
β βββ TextRefinementService.swift # Text capture & replacement
βββ Views/
β βββ SettingsView.swift # Settings UI with connection testing
β βββ RefinementCardView.swift # Individual card editor
β βββ LoadingIndicatorWindow.swift # Cursor-following progress UI
βββ SeaCrabApp.swift # App entry & menu bar
- AppDelegate: Manages menu bar icon, keyboard monitoring, and app lifecycle
- RefinementCard: Model combining prompt, shortcut, and name into a reusable preset
- KeyboardShortcutMonitor: Uses Carbon Event Taps to monitor multiple shortcuts simultaneously
- TextRefinementService: Handles text capture via pasteboard simulation and card-based refinement
- LLMService: Integration with OpenAI-compatible APIs via MacPaw/OpenAI package
- LoadingIndicatorWindow: Floating progress indicator that follows cursor at 60fps
- RefinementCardView: Interactive editor for creating and modifying refinement cards
- macOS 15.2+
- Xcode 16.2+
- Swift 6.0+
- Valid API key for your chosen OpenAI-compatible service
- MacPaw/OpenAI - Swift package for OpenAI API interaction
- Accessibility: Required to monitor global keyboard shortcuts and simulate keyboard events for text capture/replacement
Each refinement card allows a unique combination of prompt and keyboard shortcut:
- Open Settings from the menu bar
- Scroll to "Refinement Cards" section
- Click + Add New Refinement Card
- Configure the card:
- Name: Give it a descriptive name
- Keyboard Shortcut: Click "Record" and press your desired combination
- Prompt: Write or paste your custom refinement instructions
- All changes auto-save
- Create as many cards as you need for different refinement styles
Example Setup:
- Card 1: "Quick Fix" -
Control + R- Grammar and spelling only - Card 2: "Concise" -
Control + Shift + R- Remove unnecessary words - Card 3: "Professional" -
Control + Option + R- Formal business tone - Card 4: "Expand" -
Control + Command + R- Add more details and context
SeaCrab works with any OpenAI-compatible API:
Local LLM Servers:
- LM Studio -
http://localhost:1234/v1 - Ollama with OpenAI compatibility
- text-generation-webui
Cloud Providers:
- OpenRouter - Access multiple models
- Together AI
- Groq
- Any other OpenAI-compatible endpoint
- Ensure accessibility permissions are granted
- Check if another app is using the same shortcut
- Try setting a different shortcut combination
- Restart SeaCrab after granting permissions
- Use the Test Connection button to verify your setup
- Verify your API key is correct
- Check the Base URL is properly formatted
- Ensure your API account has credits/access
- Check network connectivity
The "Test Connection" button sends a simple message to verify:
- Base URL is reachable
- API key is valid
- Model is accessible
- API returns valid responses
- Some applications may block pasteboard access
- Try selecting text again before pressing the shortcut
- Check accessibility permissions are granted
open SeaCrab.xcodeproj
# Build and run from Xcode (βR)Use the provided script to create a DMG installer:
# Build and create DMG with version
./scripts/create-dmg.sh 1.0.0
# Build and create dev DMG
./scripts/create-dmg.sh devThe script will:
- Build the app in Release configuration
- Create a DMG file with drag-to-Applications support
- Generate SHA256 checksum
Requirements:
- Xcode 16.2+
- Optional:
create-dmg(brew install create-dmg) for better DMG styling
The project includes a GitHub Actions workflow that automatically:
- Builds the app when a new tag is pushed
- Creates a DMG installer
- Publishes a GitHub release with the DMG
To create a release:
# Tag the release
git tag -a v1.0.0 -m "Release version 1.0.0"
# Push the tag to trigger the workflow
git push origin v1.0.0The workflow will automatically create a release at https://github.com/YOUR_USERNAME/SeaCrab/releases
Created by caishilin on 2025/11/10.
This is a personal project, but feedback and suggestions are welcome!