# Pinme LLM

Use this skill when a PinMe project (Worker TypeScript) needs to call OpenRouter-backed...

- Repository: https://github.com/glitternetwork/pinme (3753 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-09-12
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add glitternetwork/pinme --skill pinme-llm -g -a claude-code -y`
Codex: `npx skills add glitternetwork/pinme --skill pinme-llm -g -a codex -y`
Cursor: `npx skills add glitternetwork/pinme --skill pinme-llm -g -a cursor -y`
Gemini CLI: `npx skills add glitternetwork/pinme --skill pinme-llm -g -a gemini-cli -y`

## Description

Use this skill when a PinMe project (Worker TypeScript) needs to call OpenRouter-backed LLM APIs, including models, chat/completions, streaming, or OpenRouter web search. Guides AI to generate correct Worker TS code.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# PinMe Worker OpenRouter API Integration

Guides how to call PinMe platform's OpenRouter proxy APIs in a PinMe Worker (TypeScript). Workers use the PinMe project API key; they never hold the real OpenRouter API key.

## Environment Variables

The following environment variables are automatically injected when the Worker is created, no manual configuration needed:

```typescript
// backend/src/worker.ts
export interface Env {
  DB: D1Database;
  API_KEY: string;       // Project API Key from create_worker
  PROJECT_NAME: string;  // Actual project_name from create_worker; must match API_KEY
  BASE_URL?: string;     // Optional override for PinMe API base URL, defaults to https://pinme.cloud
}
```

> `API_KEY` authenticates the Worker to PinMe. `PROJECT_NAME` is required for `chat/completions` and must belong to the same project as `API_KEY`. When `BASE_URL` is not set, use `https://pinme.cloud`.

---

## Models API

**Endpoint:** `GET {BASE_URL}/api/v1/models`
**Authentication:** `X-API-Key` header (using `env.API_KEY`)
**Request Body:** none

Use this when the Worker needs to list available OpenRouter models. The response body, status, and headers are passed through from OpenRouter `/models`.

```typescript
async function listModels(env: Env): Promise<unknown> {
  const baseUrl = env.BASE_URL ?? 'https://pinme.cloud';
  const resp = await fetch(`${baseUrl}/api/v1/models`, {
    headers: { 'X-API-Key': env.API_KEY },
  });

  if (!resp.ok) {
    throw new Error(await extractPinmeOpenRouterError(resp));
  }

  return await resp.json();
}
```

---

## Chat Completions API

**Endpoint:** `POST {BASE_URL}/api/v1/chat/completions?project_name={project_name}`
**Authentication:** `X-API-Key` header (using `env.API_KEY`)
**Request Body:** OpenRouter chat/completions format, passed through as-is after a 1MB size check
**Streaming:** Supports SSE (`stream: true`)
**Web Search:** Supports OpenRouter `openrouter:web_search` server tool via the `tools` array

The rest: https://github.com/glitternetwork/pinme/blob/HEAD/skills/pinme-llm/SKILL.md
