openrouter-openai-compat
Skill by jeremylongshore
Migrates existing OpenAI SDK code to OpenRouter by changing the base URL and API key. It covers model ID mapping, feature differences, and a dual-provider switch for developers who already use the OpenAI SDK.
Install openrouter-openai-compat
Built from the published package, never by AI.
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.claude/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-openai-compat ~/.claude/skills/openrouter-openai-compatRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install openrouter-openai-compat in Claude Code
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-openai-compat ~/.gemini/antigravity-cli/skills/openrouter-openai-compatAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install openrouter-openai-compat in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill explains how to move existing OpenAI SDK code to OpenRouter. The source says OpenRouter implements the OpenAI Chat Completions API, so changing base_url and api_key is the main step. It also covers prefixing model IDs such as openai/gpt-4o, and lists which features work the same and which differ, such as the organization parameter and limited embeddings.
It describes OpenRouter-only options passed through extra_body, including model fallbacks, provider preferences, and a web search plugin. A Dual-Provider Pattern uses the LLM_PROVIDER environment variable to switch between direct OpenAI and OpenRouter. It is aimed at developers who already use the OpenAI Python or TypeScript SDK and want to switch providers or keep both working.
Written from the project's SKILL.md and checked against it.
What it can do
- Two-line migrationPoints an existing OpenAI SDK client at OpenRouter by changing base_url and api_key.
- Model ID mappingShows how OpenAI model names map to provider-prefixed OpenRouter IDs such as openai/o1.
- Feature compatibility checkLists which features work identically, including streaming, tools, JSON mode, and stop sequences.
- Difference workaroundsGives workarounds for differences such as the organization parameter, embeddings, and logprobs.
- Model fallbacksSets an ordered list of models with the fallback route through extra_body.
- Provider preferencesSets provider order, fallback behaviour, and price sorting through extra_body.
- Web search pluginEnables the web plugin on a request to add real-time web search.
- Dual-provider clientUses a create_client function that switches between OpenAI and OpenRouter based on LLM_PROVIDER.
What you need
- OpenRouter API key set as OPENROUTER_API_KEY
- Existing OpenAI SDK integration (chat.completions.create)
- Python 3.8+ with the openai package, or Node.js 18+ with the openai npm package
- Optional OPENAI_API_KEY for switching back to direct OpenAI
Try asking
- Migrate my OpenAI chat code to OpenRouter with minimal changes
- Convert my model names to OpenRouter provider-prefixed IDs
- Add a create_client function that switches between OpenAI and OpenRouter
Good to know
- Embeddings have limited support on OpenRouter
- Fine-tuned models are not directly accessible
- The organization parameter is not used
- The Responses API is in beta support
Security check
B- Allowed to use Write, Edit without limitsIn
SKILL.md
Checked automatically: skills/.curated/openrouter-openai-compat/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: ReadWriteEditGrepBash(python3:*)Bash(node:*)
Alternatives to openrouter-openai-compat
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
openrouter-openai-compat: common questions
Does the migration require a new SDK?
No. The source says you keep the same openai package or npm package you already use, with no new dependency.
Can I use non-OpenAI models through the same code?
Yes. The source says you change the model string to a provider-prefixed ID such as anthropic/claude-3.5-sonnet, and the same client works.
Can I switch back to direct OpenAI later?
Yes. The Dual-Provider Pattern uses the LLM_PROVIDER environment variable to move traffic between direct OpenAI and OpenRouter.
How do I install openrouter-openai-compat?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is openrouter-openai-compat free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is openrouter-openai-compat safe to use?
It scores 76 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use write, edit without limits). Review the code before you install. How grades work.
What are alternatives to openrouter-openai-compat?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
