openrouter-setup

openrouter-setup is a command for coding agents from OXI-717/ai-native-toolkit. It costs 45 tokens per session (794 once invoked), scanned A, original, MIT.

A setup command for connecting software to OpenRouter, a service that provides access to several AI models through an OpenAI-compatible interface. It uses an environment variable named OPENROUTER_API_KEY so the secret stays out of source code.

In plain words
What is it for?
Use it to configure or smoke-test access to models such as Kimi K3, DeepSeek V4, or GLM through OpenRouter, while keeping the API key in the shell environment.
Why use it?
It provides a short procedure for configuring the connection and checking whether the required key is available, without placing the key in a repository. It also explains what to do when the key is missing.

Command

Part of the openrouter-setup plugin — 1 skill, 1 command shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/oxi-717/ai-native-toolkit/openrouter-setup
Clone the repo
git clone --depth 1 https://github.com/OXI-717/ai-native-toolkit

Or install openrouter-setup, the plugin that ships this one along with the rest of its 1 skill, 1 command.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for openrouter-setup

README.md
[![agentmods](https://agentmods.dev/badge/commands/oxi-717/ai-native-toolkit/openrouter-setup.svg)](https://agentmods.dev/commands/oxi-717/ai-native-toolkit/openrouter-setup)
Your own site
<a href="https://agentmods.dev/commands/oxi-717/ai-native-toolkit/openrouter-setup"><img src="https://agentmods.dev/badge/commands/oxi-717/ai-native-toolkit/openrouter-setup.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 794 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.00794
Opus 5 $0.00023 $0.00397
Sonnet 5 $0.00009 $0.00159
Haiku 4.5 $0.00005 $0.00079

Measured 4d ago against content hash 06c58cdb1455, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

openrouter-setup scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -sS https://openrouter.ai/api/v1/chat/completions \
plugins/openrouter-setup/commands/openrouter-setup.md · 82 lines

How it starts

The opening of the file, as written. The whole thing — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenRouter Access Setup

Configure OpenRouter as an OpenAI-compatible endpoint for waitlist-gated models (moonshotai/kimi-k3, deepseek/deepseek-v4, z-ai/glm-*). One key, OPENROUTER_API_KEY, unlocks all of them.

  • Endpoint: https://openrouter.ai/api/v1 (OpenAI Chat Completions compatible)
  • Key lives in env only — never in code or any repo file.

Input

$ARGUMENTS

Optional model slug to smoke-test; defaults to moonshotai/kimi-k3.

Workflow

This is an abbreviated quick-reference. The authoritative, full workflow lives in skills/openrouter-setup/SKILL.md — follow it (it covers the security contract, client-wiring examples, and the full error table).

Step 1: Check the key is in the environment (never print the value)

if [ -n "$OPENROUTER_API_KEY" ]; then
  echo "OPENROUTER_API_KEY is set (length ${#OPENROUTER_API_KEY})"
else
  echo "OPENROUTER_API_KEY is NOT set"
fi

Step 2: If missing — user creates the key interactively

Direct the user to https://openrouter.aiKeysCreate Key (sk-or-v1-…). The agent cannot do this step.

Step 3: Persist in shell profile (env, not code)

Tell the user to add to ~/.zshrc / ~/.bashrc (NOT a repo file):

export OPENROUTER_API_KEY='sk-or-v1-…'

source ~/.zshrc or start a new shell. Do not edit the user's profile without confirmation; never write the key under the project tree.

Step 4: Smoke-test (argument slug or default moonshotai/kimi-k3)

: "${OPENROUTER_API_KEY:?OPENROUTER_API_KEY is not set — see Step 3}"
curl -sS https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<MODEL_SLUG>",
    "max_tokens": 16,
    "messages": [{"role": "user", "content": "ping"}]
  }'

200 + choices = OK. 401 = bad key; 402 = no credits; 404 = wrong/retired slug (check openrouter.ai/models).

Step 5: Wire into clients

Point any OpenAI-compatible client at base_url=https://openrouter.ai/api/v1 with api_key read from $OPENROUTER_API_KEY. See SKILL.md for the Python openai SDK example and runtime-provider notes.

Read the full file on GitHub · 82 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 82 lines · 45 tokens per session scan A 06c58cdb1455

Subscribe to this mod's changes

openrouter-setup is a command published in the GitHub repository OXI-717/ai-native-toolkit (7 stars, last pushed 12d ago), licensed MIT. It adds 45 tokens to every session and 794 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.