PinMe Worker OpenRouter API Integration
Call OpenRouter-backed LLM APIs from a PinMe Worker (TypeScript) with streaming and web search support.
Evidence shows: the skill explicitly requires Workers to use only the project API key and never hold the real OpenRouter key, clearly describes data flow (X-API-Key, pass-through of OpenRouter responses). Dependencies are common npm packages (axios, etc.), CI includes dependency audit. No malicious behavior or overreach detected. Deductions: unverified publisher identity; least-privilege incomplete (no explicit restriction to only endpoints; potential over-permission); no rollback mechanism or user confirmation steps. Hence 17.
Evidence shows: comprehensive code examples (models, chat/completions, streaming) are self-consistent and runnable. Error handling pattern is detailed (extractPinmeOpenRouterError). Test suite covers CLI commands but not the skill's key LLM integration path. Deductions: static review without execution; tests do not cover OpenRouter API calls. Hence 10.
Evidence shows: clear scenario (PinMe Worker calling OpenRouter), environment variables documented, non-fit ranges not explicit but inferable (when not using Worker). Trigger description is precise. Deductions: non-fit scenarios not explicitly stated; mainland-China network reachability of pinme.cloud not addressed, warranting deduction. Hence 12.
Evidence shows: well-structured document with sections, error tables, code examples. README, MIT license, version in package.json (2.0.11), CI, tests present. Deductions: no changelog; no known-limitations section (only mentions 1MB request limit); maintenance responsibility unclear (author field 'Glitter Protocol' unverified). Hence 13.
Evidence shows: clear goals, multiple examples, expected outputs (non-streaming JSON, streaming SSE). Static review cannot verify actual usefulness; marginal value high (avoids manual API lookups). Deductions: no verified outputs; cannot prove direct usability without execution. Hence 7.
Evidence shows: CI workflow, test suite (CLI tests), but no unit/integration tests for the skill's code. No third-party corroboration. Deductions: static review without execution; test coverage insufficient. Hence 5.
- The skill depends on pinme.cloud, which may be blocked in mainland China; user should verify reachability before relying on it in production.
- The skill uses the project API key but does not restrict Worker to only the documented endpoints; if Worker code is compromised, there is a risk of key leakage.
- No rollback or recovery plan provided; failed OpenRouter calls may leave inconsistent state.
- Publisher identity is unverified; conduct your own supply-chain audit before use.
What does this skill do, and when should you use it?
This skill provides a guide for invoking OpenRouter-proxied APIs within a PinMe Worker (TypeScript) project. It covers listing models, chat completions with SSE streaming, and web search via OpenRouter's openrouter:web_search server tool. Workers use automatically injected environment variables (API_KEY, PROJECT_NAME, BASE_URL) with no manual configuration. Complete TypeScript code examples, error handling patterns, and a frontend SSE consumer example are included to help developers integrate LLM features quickly.
This skill instructs how to implement in a PinMe Worker: 1) GET /api/v1/models to list available models; 2) POST /api/v1/chat/completions for non-streaming chat completions; 3) passthrough of streaming SSE responses; 4) web search by passing the openrouter:web_search tool in the tools array; 5) extraction of OpenRouter errors from PinMe's wrapped error format.
- Building a full-stack app with an LLM chat interface, such as an AI customer support bot, with the backend running on PinMe Worker
- Scenarios requiring streaming output, like a typewriter-effect chat UI
- Need for LLM to access up-to-date information, e.g., search-augmented answers or real-time summaries
- Developers who want to use various OpenRouter models without exposing the API key directly, relying on PinMe's platform for authentication
What are this skill's strengths and limitations?
- Environment variables are auto-injected, avoiding manual API key or base URL setup
- Supports SSE streaming and web search, feature-rich
- Provides clear error code table and extraction function for easy debugging
- Complete code examples ready to copy-paste
- Only works with PinMe Worker projects, requiring platform-specific project creation
- Error messages depend on PinMe's wrapping format and may change with platform updates
- No test or unit-test examples provided; you must write your own
- Requires an existing PinMe project (create_worker); cannot be used standalone
How do you install this skill?
Run in Claude Code: npx skills add glitternetwork/pinme. The skill installs with the repository.
How do you use this skill?
In a Worker project, ensure the Env interface (with API_KEY, PROJECT_NAME, BASE_URL) exists as generated by create_worker. Follow the code examples in the skill to implement route handlers. For example, add a POST /api/chat route calling the callLLM function for non-streaming responses, or a POST /api/chat/stream route using handleChatStream for SSE passthrough. No manual environment configuration is needed; variables are injected automatically.