Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/openrouter-openai-compat

@0d57af8
Run it yourself

Migrate from OpenAI to OpenRouter with minimal code changes. Use when switching to OpenRouter or maintaining dual compatibility. Triggers: 'openrouter openai compatible', 'openrouter drop-in', 'openai to openrouter', 'openrouter migration'.

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/openrouter-openai-compat

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesdrop-in-replacement.md

≈284 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Drop-In Replacement

Drop-in Replacement

The Key Insight

OpenRouter is OpenAI API compatible.
Change base URL and API key, keep everything else.

Python Migration

# Before (OpenAI direct)
from openai import OpenAI

client = OpenAI(
    api_key="sk-..."  # OpenAI key
)

# After (OpenRouter)
from openai import OpenAI

client = OpenAI(
    base_url="https://openrouter.ai/api/v1",
    api_key="sk-or-..."  # OpenRouter key
)

# Code stays exactly the same!
response = client.chat.completions.create(
    model="openai/gpt-4-turbo",  # Add provider prefix
    messages=[{"role": "user", "content": "Hello"}]
)

TypeScript Migration

// Before (OpenAI direct)
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-...',
});

// After (OpenRouter)
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://openrouter.ai/api/v1',
  apiKey: 'sk-or-...',
});

// Same code works!
const response = await client.chat.completions.create({
  model: 'openai/gpt-4-turbo',  // Add provider prefix
  messages: [{ role: 'user', content: 'Hello' }],
});

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides legitimate documentation and code examples for migrating from the OpenAI SDK to OpenRouter. No security issues were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
What it can do
Reads files Edits files Runs commands
version
1.20.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
[
  "saas",
  "openrouter",
  "api",
  "migration",
  "openai"
]
All 6 allowed tools
ReadWriteEditGrepBash(python3:*)Bash(node:*)
Other metadata
compatibility
Designed for Claude Code

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/openrouter-openai-compat