Skip to content

Add Kimi K2 via OpenRouter#4

Open
olyaiy wants to merge 1 commit intomainfrom
codex/add-kimi-k2-model-to-models-list
Open

Add Kimi K2 via OpenRouter#4
olyaiy wants to merge 1 commit intomainfrom
codex/add-kimi-k2-model-to-models-list

Conversation

@olyaiy
Copy link
Copy Markdown
Owner

@olyaiy olyaiy commented Jul 13, 2025

Summary

  • integrate OpenRouter provider
  • register kimi-k2 model using OpenRouter

Testing

  • pnpm lint

https://chatgpt.com/codex/tasks/task_e_687402f88aac8321a22c035fa6d3a2e6


Open with Devin

@vercel
Copy link
Copy Markdown

vercel bot commented Jul 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
agent-vendor 🛑 Canceled (Inspect) Jul 13, 2025 7:43pm

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment on lines +17 to +20
export const openrouter = createOpenAI({
baseURL: 'https://openrouter.ai/api/v1',
name: 'openrouter',
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 OpenRouter provider uses OpenAI API key, leaking it to a third-party service

The openrouter provider at lib/models.ts:17-20 is created via createOpenAI without specifying an apiKey. The createOpenAI function from @ai-sdk/openai defaults to using the OPENAI_API_KEY environment variable. This means when the kimi-k2 model is invoked, the user's OpenAI API key is sent as the Bearer token to https://openrouter.ai/api/v1 — a third-party service. This is both a security vulnerability (API key leakage) and a functional bug (OpenRouter will reject the OpenAI key, causing authentication failures).

Suggested change
export const openrouter = createOpenAI({
baseURL: 'https://openrouter.ai/api/v1',
name: 'openrouter',
});
export const openrouter = createOpenAI({
baseURL: 'https://openrouter.ai/api/v1',
apiKey: process.env.OPENROUTER_API_KEY,
name: 'openrouter',
});
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant