Agent skill

Openrouter Install Auth

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Set up OpenRouter API authentication and configure API keys.

MITAuto-check: notesAI & LLM Engineering

Install Openrouter Install Auth

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-install-auth -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace openrouter-install-auth --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/openrouter-install-auth .claude/skills/openrouter-install-auth && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
openrouter-install-auth
GitHub stars
2.8k
Token cost
~1.6k tokens
SKILL.md length
399 words
Files
4 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Set up OpenRouter API authentication and configure API keys.

  • Works in 5 steps: Generate an API Key → Configure Environment → Initialize the Client → …
  • Starting a new OpenRouter integration
  • SKILL.md covers Overview, Prerequisites, Instructions and Required Headers, plus 7 more sections
  • Calls pip and npm; reaches openrouter.ai; needs OPENROUTER_API_KEY and MGMT_KEY

What it does

Openrouter Install Auth is an agent skill from jeremylongshore/tons-of-skills-marketplace. Set up OpenRouter API authentication and configure API keys. Use when starting a new OpenRouter integration, rotating keys, or troubleshooting auth issues. Triggers: 'openrouter setup', 'openrouter api key', 'configure openrouter auth', 'sk-or key'.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/environment-setup.md`, `references/errors.md` and `references/examples.md`). Compatibility notes: Designed for Claude Code

It sits in AI & LLM Engineering, covering Model routing and gateways. It works with OpenRouter and OpenAI. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Starting a new OpenRouter integration
  • Troubleshooting auth issues

Example prompts

  • “openrouter setup”
  • “openrouter api key”
  • “configure openrouter auth”
  • “/openrouter-install-auth”

Requirements

  • Python 3
  • Node.js
  • A credential in OPENROUTER_API_KEY
  • A credential in MGMT_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Bash(python3:*), Bash(node:*), Bash(pip:*), Bash(npm:*)

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Generate an API Key
  2. Configure Environment
  3. Initialize the Client
  4. Verify Authentication
  5. Send a Test Request

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Bash(python3:*)
    • Bash(node:*)
    • Bash(pip:*)
    • Bash(npm:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pip
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • openrouter.ai

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • OPENROUTER_API_KEY
    • MGMT_KEY
    • OPENROUTER_MGMT_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Openrouter Install Auth loads about 1.6k tokens when it runs, and up to ~2.7k if it reads all its reference files. Until then it costs about 68 tokens; SKILL.md has 399 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:45
    # .env file (add .env to .gitignore!)
  • NoteMentions a .env fileSKILL.md:135
    et in your environment (or a gitignored `.env` file), holding the `sk-or-v1-...` key from [openrouter.ai/keys](https://o

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 399 words, ~1,635 tokens.

Download SKILL.mdSave it as .claude/skills/openrouter-install-auth/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
openrouter-install-auth
description
Set up OpenRouter API authentication and configure API keys. Use when starting a new OpenRouter integration, rotating keys, or troubleshooting auth issues. Triggers: 'openrouter setup', 'openrouter api key', 'configure openrouter auth', 'sk-or key'.
allowed-tools
Read, Write, Edit, Grep, Bash(python3:*), Bash(node:*), Bash(pip:*), Bash(npm:*)
compatibility
Designed for Claude Code
version
1.20.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, openrouter, api, authentication, setup

OpenRouter Install & Auth

Overview

Set up OpenRouter API credentials, configure the OpenAI-compatible client, verify authentication, and check credit balance. OpenRouter keys start with sk-or-v1- and authenticate against https://openrouter.ai/api/v1.

Prerequisites

  • OpenRouter account (free at openrouter.ai)
  • Python 3.8+ or Node.js 18+
  • OpenAI SDK (pip install openai or npm install openai)

Instructions

1. Generate an API Key
  1. Go to openrouter.ai/keys
  2. Click Create Key, name it (e.g., my-app-dev)
  3. Copy the sk-or-v1-... value immediately (shown only once)
  4. Optionally set a credit limit on the key for spend control
2. Configure Environment
bash
# .env file (add .env to .gitignore!)
OPENROUTER_API_KEY=sk-or-v1-your-key-here

# Or export directly
export OPENROUTER_API_KEY="sk-or-v1-your-key-here"
3. Initialize the Client

Python:

python
from openai import OpenAI

client = OpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key=os.environ["OPENROUTER_API_KEY"],
    default_headers={
        "HTTP-Referer": "https://your-app.com",  # For analytics attribution
        "X-Title": "Your App Name",               # Shows in dashboard
    },
)

TypeScript:

typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://openrouter.ai/api/v1",
  apiKey: process.env.OPENROUTER_API_KEY,
  defaultHeaders: {
    "HTTP-Referer": "https://your-app.com",
    "X-Title": "Your App Name",
  },
});
4. Verify Authentication
python
# Quick auth + credit check
import requests

resp = requests.get(
    "https://openrouter.ai/api/v1/auth/key",
    headers={"Authorization": f"Bearer {os.environ['OPENROUTER_API_KEY']}"},
)
data = resp.json()["data"]
print(f"Key: {data['label']}")
print(f"Credits used: ${data['usage']:.4f}")
print(f"Credit limit: ${data.get('limit', 'unlimited')}")
print(f"Free tier: {data['is_free_tier']}")
print(f"Rate limit: {data['rate_limit']['requests']} req / {data['rate_limit']['interval']}")
5. Send a Test Request
python
response = client.chat.completions.create(
    model="google/gemma-2-9b-it:free",  # Free model for testing
    messages=[{"role": "user", "content": "Say hello"}],
    max_tokens=50,
)
print(response.choices[0].message.content)
print(f"Tokens: {response.usage.prompt_tokens} in / {response.usage.completion_tokens} out")

Required Headers

HeaderPurposeRequired
AuthorizationBearer sk-or-v1-...Yes
HTTP-RefererYour app URL for dashboard attributionRecommended
X-TitleApp name shown in OpenRouter dashboardRecommended
Content-Typeapplication/jsonYes (POST)

Key Formats

TypePatternPurpose
Standard keysk-or-v1-...API access (chat completions, models)
Management keysk-or-v1-...Key provisioning only (cannot call completions)
BYOK provider keyVaries by providerBring-your-own-key for direct provider access

Output

A completed setup leaves you with:

  • OPENROUTER_API_KEY set in your environment (or a gitignored .env file), holding the sk-or-v1-... key from openrouter.ai/keys
  • A configured OpenAI-SDK client pointed at https://openrouter.ai/api/v1 with HTTP-Referer and X-Title headers for dashboard attribution
  • An auth-verification printout from /api/v1/auth/key: key label, credits used, credit limit, free-tier flag, and rate limit
  • A test completion from the free model (google/gemma-2-9b-it:free) with its reply text and prompt/completion token counts
Show full SKILL.md (163 more words)Show less

Examples

Running the step-4 verification against a fresh key prints something like:

text
Key: my-app-dev
Credits used: $0.0000
Credit limit: unlimited
Free tier: True
Rate limit: 10 req / 10s

Then the step-5 test request returns a greeting plus Tokens: 9 in / 12 out, confirming the key can call completions end-to-end. More worked examples: references/examples.md.

Error Handling

HTTPError CodeCauseFix
401invalid_api_keyKey malformed, revoked, or wrongRegenerate at openrouter.ai/keys
401missing_api_keyNo Authorization headerAdd Authorization: Bearer sk-or-v1-...
403insufficient_creditsZero balance on paid modelAdd credits at openrouter.ai/credits or use :free model
403key_disabledKey was disabled by adminRe-enable in dashboard or create new key

Key Rotation

python
# Programmatic key management via Management API
import requests

MGMT_KEY = os.environ["OPENROUTER_MGMT_KEY"]  # Management key, not API key

# Create a new key
resp = requests.post(
    "https://openrouter.ai/api/v1/keys",
    headers={"Authorization": f"Bearer {MGMT_KEY}"},
    json={"name": "my-app-prod-v2", "limit": 100.0},
)
new_key = resp.json()["data"]["key"]  # sk-or-v1-...

# List existing keys
keys = requests.get(
    "https://openrouter.ai/api/v1/keys",
    headers={"Authorization": f"Bearer {MGMT_KEY}"},
).json()

Enterprise Considerations

  • Store keys in a secrets manager (AWS Secrets Manager, GCP Secret Manager, Vault)
  • Use management keys to provision per-service API keys programmatically
  • Set credit limits per key to isolate blast radius
  • Rotate keys on a schedule (90 days recommended)
  • Add secret scanning to CI pipelines (e.g., gitleaks, trufflehog)
  • Use BYOK for direct provider billing when volume justifies it

References

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/.curated/openrouter-install-auth of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/environment-setup.md
  • references/errors.md
  • references/examples.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Openrouter Install Auth next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Openrouter Install Auth compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Openrouter Install Auth this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.6kAutomated safety check: NotesMIT
Embeddings via 9Routerdecolua/9router31k—~604Automated safety check: PassMIT
Using Ccproxy Inspectorstarbaser/ccproxy350—~2.7kAutomated safety check: PassCustom licence
Mecatl Model Router Configstacklok/mecatl254—~2.7kAutomated safety check: PassApache-2.0
Using Ccproxy APIstarbaser/ccproxy350—~4kAutomated safety check: PassCustom licence
Configuring Visionoxbshw/watch-skill470—~509Automated safety check: NotesMIT

Similar skills

  • Embeddings via 9Router

    decolua/9router

    Generates vector embeddings through the 9Router /v1/embeddings endpoint, using models from providers such as OpenAI, Gemini, Mistral and Voyage for RAG and semantic search.

    31k GitHub stars~604 tokensUpdated 3 days ago
    AI & LLM EngineeringAuto-check passed
  • Using Ccproxy Inspector

    starbaser/ccproxy

    Operates the ccproxy inspector MITM system for intercepting, inspecting, and transforming LLM API traffic.

    350 GitHub stars~2.7k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Interviews you about provider, cost, openness and image needs, then designs the models section of a mecatl settings file with aliases, slots and router categories.

    254 GitHub stars~2.7k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Using Ccproxy API

    starbaser/ccproxy

    Guides users through ccproxy as an OpenAI-compatible and Anthropic-compatible LLM API server with SDK integration, OAuth authentication, sentinel key substitution, model routing, and troubleshooting.

    350 GitHub stars~4k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Configuring Vision

    oxbshw/watch-skill

    The user wants to connect an LLM or vision provider, already has an API key, asks "can I use OpenAI/Anthropic/Gemini/OpenRouter", wants local Ollama, or needs different cheap and strong models.

    470 GitHub stars~509 tokensUpdated 26 days ago
    AI & LLM EngineeringAuto-check: notes
  • Quorum

    Detrol/quorum-cli

    Run a structured debate between agent CLIs (claude, codex, agy, grok) and the user's configured API or local models (OpenAI, Anthropic, Google, xAI, OpenRouter, Ollama and more) through the Quorum…

    119 GitHub stars~807 tokensUpdated 14 days ago
    AI & LLM EngineeringAuto-check: notes

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Openrouter Install Auth

What does Openrouter Install Auth do?

Set up OpenRouter API authentication and configure API keys. Openrouter Install Auth is an agent skill from jeremylongshore/tons-of-skills-marketplace. Set up OpenRouter API authentication and configure API keys.

When should I use Openrouter Install Auth?

Openrouter Install Auth fits situations like: starting a new OpenRouter integration; troubleshooting auth issues.

How do I install Openrouter Install Auth in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-install-auth -a claude-code`. Or copy the skill folder (skills/.curated/openrouter-install-auth in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/openrouter-install-auth in your project. Claude Code loads it when a task matches its description.

How do I install Openrouter Install Auth in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-install-auth -a codex`. Or copy the skill folder (skills/.curated/openrouter-install-auth in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/openrouter-install-auth in your project. Codex loads it when a task matches its description.

Can I use Openrouter Install Auth in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill openrouter-install-auth -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/openrouter-install-auth, .gemini/skills/openrouter-install-auth, .github/skills/openrouter-install-auth and .opencode/skills/openrouter-install-auth in your project.

What does Openrouter Install Auth need to run?

Going by SKILL.md and its folder, Openrouter Install Auth needs the command-line tools its instructions call (pip and npm) and credentials named OPENROUTER_API_KEY, MGMT_KEY and OPENROUTER_MGMT_KEY. Our summary lists: Python 3; Node.js; A credential in OPENROUTER_API_KEY; A credential in MGMT_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Bash(python3:*), Bash(node:*), Bash(pip:*), Bash(npm:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Openrouter Install Auth access the network?

SKILL.md names 1 domain. In commands or code: openrouter.ai; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Openrouter Install Auth safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Openrouter Install Auth use?

Openrouter Install Auth is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Openrouter Install Auth use?

About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.1k tokens, read only when the agent opens those files.

What are the alternatives to Openrouter Install Auth?

Skills that share tags, products or a category with Openrouter Install Auth: Embeddings via 9Router (decolua/9router, 31k stars), Using Ccproxy Inspector (starbaser/ccproxy, 350 stars), Mecatl Model Router Config (stacklok/mecatl, 254 stars) and Using Ccproxy API (starbaser/ccproxy, 350 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Openrouter Install Auth?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.