For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
  • Get Started
    • Quickstart: Build a Chat App
    • Enterprise Quickstart
    • Free Models Router
  • Working with Coding Agents
    • Automatic Code Review
    • Claude Code
    • Claude Desktop
    • Codex CLI
    • Cursor
    • Hermes Agent
    • Junie CLI
    • MCP Servers
    • OpenClaw 🦞
    • OpenCode
  • Building Agents
    • Add Human-in-the-Loop Controls
    • Build a Long-Horizon Agent
    • Build Your Own Agent TUI
    • Build Your Own Headless Agent
  • Video Generation
    • Choose a Video Generation Model
    • Generate and Download a Video from Text
    • Get Video Results with Webhooks
    • Guide a Video with Reference Images
    • Turn an Image into a Video
    • Use Provider-Specific Video Options
  • Evaluate & Optimize
    • Distillation
    • RAG with Embeddings & Rerank
    • Red Teaming
  • Administration
    • Activity Export
    • API Key Rotation
    • Crypto API
    • Organization Management
    • Usage Accounting
    • User Tracking
LogoLogo
ModelsChatRankingsDocs
On this page
  • Using Junie CLI with OpenRouter
  • Why Use OpenRouter with Junie?
  • Prerequisites
  • Step 1: Install Junie CLI
  • Step 2: Configure OpenRouter
  • Step 3: Start Coding
  • Headless Mode (CI/CD)
  • GitHub Actions Example
  • GitLab CI/CD Example
  • Verify Your Connection
  • Learn More
Working with Coding Agents

Junie CLI

Using OpenRouter with JetBrains Junie CLI
Was this page helpful?
Previous

Using MCP Servers with OpenRouter

Use MCP Servers with OpenRouter
Next
Built with

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
$curl -fsSL https://junie.jetbrains.com/install.sh | bash

Verify the installation:

$junie --version

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:

$# Open your shell profile
$nano ~/.zshrc # or ~/.bashrc for Bash users
$
$# Add this line:
$export JUNIE_OPENROUTER_API_KEY="<your-openrouter-api-key>"

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:

$cd /path/to/your/project
$junie

Type your prompt in the interactive CLI:

> give me an overview of this codebase

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:

$# Install Junie CLI
$curl -fsSL https://junie.jetbrains.com/install.sh | bash
$
$# Run Junie with OpenRouter in headless mode
$export JUNIE_OPENROUTER_API_KEY="$OPENROUTER_API_KEY"
$junie "Review and fix any code quality issues in the latest commit"

GitHub Actions Example

1name: Code Review
2on:
3 pull_request:
4 types: [opened, synchronize]
5jobs:
6 review:
7 runs-on: ubuntu-latest
8 permissions:
9 contents: read
10 pull-requests: write
11 issues: write
12 steps:
13 - uses: actions/checkout@v4
14 with:
15 fetch-depth: 1
16 - uses: JetBrains/junie-github-action@v0
17 with:
18 openrouter_api_key: ${{ secrets.OPENROUTER_API_KEY }}
19 prompt: "code-review"

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:

#junie code-review

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