Skip to content
Documentation
Accounts

OpenRouter API key

Create an OpenRouter API key and save it to enable AI chat in your app.

View Markdown

By the end of this guide, your OpenRouter API key will be saved in the starter's root .env file, ready for Kickstart to enable AI chat.

OpenRouter is optional. If you don't want AI chat yet, leave AI_ENABLED=false and OPENROUTER_API_KEY blank, then return to Accounts.

Create and save the key

Sign in and open API Keys

Create an account or sign in at OpenRouter, then open API Keys. If you have several workspaces, choose the one for your app using the selector at the top of the sidebar.

Click the green New Key button in the top-right corner. Use API Keys, not Management Keys.

OpenRouter API Keys page with the workspace selector at the top left, API Keys selected in the sidebar, and the green New Key button at the top right. Existing keys are filtered out.
OpenRouter · API Keys → New Key. Existing keys are filtered out for privacy.

Create a key for your app

Fill in the form:

  1. Name: enter a recognizable name, such as Ship & Scale.
  2. Expiration: choose a lifetime, such as 90 days. Replace the key in your app before it expires.
  3. Credit limit: choose Custom amount and enter a testing budget, such as 5 for a $5 limit.
  4. Reset limit every…: leave N/A for a total limit that doesn't renew automatically.
OpenRouter key form filled with Name Ship & Scale, Expiration 90 days, a custom credit limit of 5 US dollars, Reset limit every set to N/A, and the green Create button.
OpenRouter · Example settings for a key with a $5 total spending limit.

Click Create, then copy the generated key and save it privately. You'll paste it into .env in the final step.

The credit limit caps this key's usage; it doesn't add money to your account. When the limit is reached, requests stop until you increase it.

Add credits for model requests

Open Credits from the sidebar. The starter's default model requires paid credits. If your account already has an available balance, you can skip the purchase.

Otherwise, click Add Credits under Buy Credits.

The Buy Credits panel on OpenRouter’s Credits page, with its green Add Credits button.
OpenRouter · Credits → Buy Credits → Add Credits.

Choose your Amount, add a payment method if needed, and review Service fees, any tax and Total due before clicking Purchase. The amounts below are an example; use the total shown in your checkout.

OpenRouter Purchase Credits form showing Amount, billing options, Service fees, Sales Tax / VAT, Total due and the green Purchase button. Payment and account details are outside the crop.
OpenRouter · Review the amount and total before purchasing credits.

After payment, confirm that Total available shows a balance. Your app's workspace credits are separate from this OpenRouter balance.

Save the key in .env

Open the root .env file beside package.json. If it doesn't exist, copy .env.example to .env. Update these existing lines and save:

Your private .env
AI_ENABLED=true
OPENROUTER_API_KEY=replace_with_your_openrouter_key
AI_MODEL=openai/gpt-4.1-mini

Replace the example key with your real value. Keep the default AI_MODEL for now and only one active line for each setting. On Windows, make sure the file is named .env, not .env.txt.

Keep the key private

This key authorizes spending from your OpenRouter account. Keep it only in .env, as described in Keep your keys private.

You are finished when

  • Your key is saved as OPENROUTER_API_KEY in the root .env file.
  • AI_ENABLED=true and AI_MODEL has a value.
  • Your OpenRouter account has credits and the key has an unused spending allowance.

Continue with Accounts, then Configuration and Kickstart. Once your other required credentials are ready, npm run kickstart:check checks the key and model without generating a paid response. Full Kickstart installs the AI feature.

Template 0.0.1 · September 2026 source snapshot