Junie CLI
Using Junie CLI with OpenRouter
Junie CLI is an agentic coding tool by JetBrains that provides an interactive terminal interface for developers to review, write, and modify code. By connecting Junie to OpenRouter, you can access hundreds of AI models from a single API key instead of managing separate keys for each provider.
Why Use OpenRouter with Junie?
- Access to hundreds of models — Use models from Anthropic, OpenAI, Google, xAI, Meta, and many more through a single API key
- Provider failover — If one provider is unavailable or rate-limited, OpenRouter automatically routes to another
- Centralized billing — Track and manage spending across all models from your OpenRouter dashboard
- Team controls — Set budgets and monitor usage across your organization
Prerequisites
- Junie CLI installed (see Step 1 below)
- An OpenRouter API key
Step 1: Install Junie CLI
Linux / macOS
Windows
Homebrew
Verify the installation:
Step 2: Configure OpenRouter
Junie supports OpenRouter as a built-in BYOK (Bring Your Own Key) provider. Set the JUNIE_OPENROUTER_API_KEY environment variable to connect Junie to OpenRouter:
Shell Profile (Recommended)
Inline
CI/CD
Add the environment variable to your shell profile for persistent configuration:
After saving, restart your terminal or run source ~/.zshrc for changes to take effect.
Replace <your-openrouter-api-key> with your actual OpenRouter API key from the API Keys page. Keys start with sk-or-v1-.
Step 3: Start Coding
Navigate to your project directory and start Junie:
Type your prompt in the interactive CLI:
Use @ to attach files or folders to the request context, and type / to see available slash commands.
Headless Mode (CI/CD)
Junie supports a headless mode for non-interactive use in CI/CD pipelines. Combined with OpenRouter, this gives you centralized billing and model access for automated coding tasks:
GitHub Actions Example
GitLab CI/CD Example
Follow the
setup instructions
to configure the Junie Workspace project, then add
JUNIE_OPENROUTER_API_KEY as a CI/CD variable. Once
set up, trigger reviews by commenting on any MR:
Verify Your Connection
After starting a session, check the OpenRouter Activity Dashboard to confirm your requests are being routed through OpenRouter.
Learn More
- Junie CLI Documentation: junie.jetbrains.com/docs
- Junie Environment Variables: Environment Variables Reference
- OpenRouter Quick Start: Getting Started with OpenRouter
- Available Models: Browse OpenRouter Models