---
name: openrouter-api
description: "OpenRouter API skill. Use when working with OpenRouter for activity, analytics, audio. Covers 87 endpoints."
version: 1.0.0
generator: lapsh
---

# OpenRouter API
API version: 1.0.0

## Auth
Bearer bearer | Bearer bearer

## Base URL
https://openrouter.ai/api/v1

## Setup
1. Set Authorization header with your Bearer token
2. GET /activity -- verify access
3. POST /analytics/query -- create first query

## Endpoints

87 endpoints across 29 groups. See references/api-spec.lap for full details.

### activity
| Method | Path | Description |
|--------|------|-------------|
| GET | /activity | Get user activity grouped by endpoint |

### analytics
| Method | Path | Description |
|--------|------|-------------|
| GET | /analytics/meta | Get available analytics metrics and dimensions |
| POST | /analytics/query | Query analytics data |

### audio
| Method | Path | Description |
|--------|------|-------------|
| POST | /audio/speech | Create speech |
| POST | /audio/transcriptions | Create transcription |

### auth
| Method | Path | Description |
|--------|------|-------------|
| POST | /auth/keys | Exchange authorization code for API key |
| POST | /auth/keys/code | Create authorization code |

### benchmarks
| Method | Path | Description |
|--------|------|-------------|
| GET | /benchmarks | List Benchmarks |

### byok
| Method | Path | Description |
|--------|------|-------------|
| GET | /byok | List BYOK provider credentials |
| POST | /byok | Create a BYOK provider credential |
| DELETE | /byok/{id} | Delete a BYOK provider credential |
| GET | /byok/{id} | Get a BYOK provider credential |
| PATCH | /byok/{id} | Update a BYOK provider credential |

### chat
| Method | Path | Description |
|--------|------|-------------|
| POST | /chat/completions | Create a chat completion |

### classifications
| Method | Path | Description |
|--------|------|-------------|
| GET | /classifications/task | Task classification market share |

### credits
| Method | Path | Description |
|--------|------|-------------|
| GET | /credits | Get remaining credits |
| POST | /credits/coinbase | Deprecated Coinbase Commerce charge endpoint |

### datasets
| Method | Path | Description |
|--------|------|-------------|
| GET | /datasets/app-rankings | Top apps by token usage |
| GET | /datasets/rankings-daily | Daily token totals for top 50 models |

### embeddings
| Method | Path | Description |
|--------|------|-------------|
| POST | /embeddings | Submit an embedding request |
| GET | /embeddings/models | List all embeddings models |

### endpoints
| Method | Path | Description |
|--------|------|-------------|
| GET | /endpoints/zdr | Preview the impact of ZDR on the available endpoints |

### files
| Method | Path | Description |
|--------|------|-------------|
| GET | /files | List files |
| POST | /files | Upload a file |
| DELETE | /files/{file_id} | Delete a file |
| GET | /files/{file_id} | Get file metadata |
| GET | /files/{file_id}/content | Download file content |

### generation
| Method | Path | Description |
|--------|------|-------------|
| GET | /generation | Get request & usage metadata for a generation |
| GET | /generation/content | Get stored prompt and completion content for a generation |

### guardrails
| Method | Path | Description |
|--------|------|-------------|
| GET | /guardrails | List guardrails |
| POST | /guardrails | Create a guardrail |
| DELETE | /guardrails/{id} | Delete a guardrail |
| GET | /guardrails/{id} | Get a guardrail |
| PATCH | /guardrails/{id} | Update a guardrail |
| GET | /guardrails/{id}/assignments/keys | List key assignments for a guardrail |
| POST | /guardrails/{id}/assignments/keys | Bulk assign keys to a guardrail |
| POST | /guardrails/{id}/assignments/keys/remove | Bulk unassign keys from a guardrail |
| GET | /guardrails/{id}/assignments/members | List member assignments for a guardrail |
| POST | /guardrails/{id}/assignments/members | Bulk assign members to a guardrail |
| POST | /guardrails/{id}/assignments/members/remove | Bulk unassign members from a guardrail |
| GET | /guardrails/assignments/keys | List all key assignments |
| GET | /guardrails/assignments/members | List all member assignments |

### images
| Method | Path | Description |
|--------|------|-------------|
| POST | /images | Generate an image |
| GET | /images/models | List image generation models |
| GET | /images/models/{author}/{slug}/endpoints | List endpoints for an image model |

### key
| Method | Path | Description |
|--------|------|-------------|
| GET | /key | Get current API key |

### keys
| Method | Path | Description |
|--------|------|-------------|
| GET | /keys | List API keys |
| POST | /keys | Create a new API key |
| DELETE | /keys/{hash} | Delete an API key |
| GET | /keys/{hash} | Get a single API key |
| PATCH | /keys/{hash} | Update an API key |

### messages
| Method | Path | Description |
|--------|------|-------------|
| POST | /messages | Create a message |

### model
| Method | Path | Description |
|--------|------|-------------|
| GET | /model/{author}/{slug} | Get a model by its slug |

### models
| Method | Path | Description |
|--------|------|-------------|
| GET | /models | List all models and their properties |
| GET | /models/{author}/{slug}/endpoints | List all endpoints for a model |
| GET | /models/count | Get total count of available models |
| GET | /models/user | List models filtered by user provider preferences, privacy settings, and guardrails |

### observability
| Method | Path | Description |
|--------|------|-------------|
| GET | /observability/destinations | List observability destinations |
| POST | /observability/destinations | Create an observability destination |
| DELETE | /observability/destinations/{id} | Delete an observability destination |
| GET | /observability/destinations/{id} | Get an observability destination |
| PATCH | /observability/destinations/{id} | Update an observability destination |

### organization
| Method | Path | Description |
|--------|------|-------------|
| GET | /organization/members | List organization members |

### presets
| Method | Path | Description |
|--------|------|-------------|
| GET | /presets | List presets |
| GET | /presets/{slug} | Get a preset |
| POST | /presets/{slug}/chat/completions | Create a preset from a chat-completions request body |
| POST | /presets/{slug}/messages | Create a preset from a messages request body |
| POST | /presets/{slug}/responses | Create a preset from a responses request body |
| GET | /presets/{slug}/versions | List versions of a preset |
| GET | /presets/{slug}/versions/{version} | Get a specific version of a preset |

### providers
| Method | Path | Description |
|--------|------|-------------|
| GET | /providers | List all providers |

### rerank
| Method | Path | Description |
|--------|------|-------------|
| POST | /rerank | Submit a rerank request |

### responses
| Method | Path | Description |
|--------|------|-------------|
| POST | /responses | Create a response |

### videos
| Method | Path | Description |
|--------|------|-------------|
| POST | /videos | Submit a video generation request |
| GET | /videos/{jobId} | Poll video generation status |
| GET | /videos/{jobId}/content | Download generated video content |
| GET | /videos/models | List all video generation models |

### workspaces
| Method | Path | Description |
|--------|------|-------------|
| GET | /workspaces | List workspaces |
| POST | /workspaces | Create a workspace |
| DELETE | /workspaces/{id} | Delete a workspace |
| GET | /workspaces/{id} | Get a workspace |
| PATCH | /workspaces/{id} | Update a workspace |
| GET | /workspaces/{id}/budgets | List workspace budgets |
| DELETE | /workspaces/{id}/budgets/{interval} | Delete a workspace budget |
| PUT | /workspaces/{id}/budgets/{interval} | Create or update a workspace budget |
| POST | /workspaces/{id}/members/add | Bulk add members to a workspace |
| POST | /workspaces/{id}/members/remove | Bulk remove members from a workspace |

## Common Questions

Match user requests to endpoints in references/api-spec.lap. Key patterns:
- "List all activity?" -> GET /activity
- "List all meta?" -> GET /analytics/meta
- "Create a query?" -> POST /analytics/query
- "Create a speech?" -> POST /audio/speech
- "Create a transcription?" -> POST /audio/transcriptions
- "Create a key?" -> POST /auth/keys
- "Create a code?" -> POST /auth/keys/code
- "List all benchmarks?" -> GET /benchmarks
- "List all byok?" -> GET /byok
- "Create a byok?" -> POST /byok
- "Delete a byok?" -> DELETE /byok/{id}
- "Get byok details?" -> GET /byok/{id}
- "Partially update a byok?" -> PATCH /byok/{id}
- "Create a completion?" -> POST /chat/completions
- "List all task?" -> GET /classifications/task
- "List all credits?" -> GET /credits
- "Create a coinbase?" -> POST /credits/coinbase
- "List all app-rankings?" -> GET /datasets/app-rankings
- "List all rankings-daily?" -> GET /datasets/rankings-daily
- "Create a embedding?" -> POST /embeddings
- "List all models?" -> GET /embeddings/models
- "List all zdr?" -> GET /endpoints/zdr
- "List all files?" -> GET /files
- "Create a file?" -> POST /files
- "Delete a file?" -> DELETE /files/{file_id}
- "Get file details?" -> GET /files/{file_id}
- "List all content?" -> GET /files/{file_id}/content
- "List all generation?" -> GET /generation
- "List all content?" -> GET /generation/content
- "List all guardrails?" -> GET /guardrails
- "Create a guardrail?" -> POST /guardrails
- "Delete a guardrail?" -> DELETE /guardrails/{id}
- "Get guardrail details?" -> GET /guardrails/{id}
- "Partially update a guardrail?" -> PATCH /guardrails/{id}
- "List all keys?" -> GET /guardrails/{id}/assignments/keys
- "Create a key?" -> POST /guardrails/{id}/assignments/keys
- "Create a remove?" -> POST /guardrails/{id}/assignments/keys/remove
- "List all members?" -> GET /guardrails/{id}/assignments/members
- "Create a member?" -> POST /guardrails/{id}/assignments/members
- "Create a remove?" -> POST /guardrails/{id}/assignments/members/remove
- "List all keys?" -> GET /guardrails/assignments/keys
- "List all members?" -> GET /guardrails/assignments/members
- "Create a image?" -> POST /images
- "List all models?" -> GET /images/models
- "List all endpoints?" -> GET /images/models/{author}/{slug}/endpoints
- "List all key?" -> GET /key
- "List all keys?" -> GET /keys
- "Create a key?" -> POST /keys
- "Delete a key?" -> DELETE /keys/{hash}
- "Get key details?" -> GET /keys/{hash}
- "Partially update a key?" -> PATCH /keys/{hash}
- "Create a message?" -> POST /messages
- "Get model details?" -> GET /model/{author}/{slug}
- "Search models?" -> GET /models
- "List all endpoints?" -> GET /models/{author}/{slug}/endpoints
- "List all count?" -> GET /models/count
- "List all user?" -> GET /models/user
- "List all destinations?" -> GET /observability/destinations
- "Create a destination?" -> POST /observability/destinations
- "Delete a destination?" -> DELETE /observability/destinations/{id}
- "Get destination details?" -> GET /observability/destinations/{id}
- "Partially update a destination?" -> PATCH /observability/destinations/{id}
- "List all members?" -> GET /organization/members
- "List all presets?" -> GET /presets
- "Get preset details?" -> GET /presets/{slug}
- "Create a completion?" -> POST /presets/{slug}/chat/completions
- "Create a message?" -> POST /presets/{slug}/messages
- "Create a response?" -> POST /presets/{slug}/responses
- "List all versions?" -> GET /presets/{slug}/versions
- "Get version details?" -> GET /presets/{slug}/versions/{version}
- "List all providers?" -> GET /providers
- "Create a rerank?" -> POST /rerank
- "Create a response?" -> POST /responses
- "Create a video?" -> POST /videos
- "Get video details?" -> GET /videos/{jobId}
- "List all content?" -> GET /videos/{jobId}/content
- "List all models?" -> GET /videos/models
- "List all workspaces?" -> GET /workspaces
- "Create a workspace?" -> POST /workspaces
- "Delete a workspace?" -> DELETE /workspaces/{id}
- "Get workspace details?" -> GET /workspaces/{id}
- "Partially update a workspace?" -> PATCH /workspaces/{id}
- "List all budgets?" -> GET /workspaces/{id}/budgets
- "Delete a budget?" -> DELETE /workspaces/{id}/budgets/{interval}
- "Update a budget?" -> PUT /workspaces/{id}/budgets/{interval}
- "Create a add?" -> POST /workspaces/{id}/members/add
- "Create a remove?" -> POST /workspaces/{id}/members/remove
- "How to authenticate?" -> See Auth section

## Response Tips
- Check response schemas in references/api-spec.lap for field details
- List endpoints may support pagination; check for limit, offset, or cursor params
- Create/update endpoints typically return the created/updated object

## CLI

```bash
# Update this spec to the latest version
npx @lap-platform/lapsh get openrouter-api -o references/api-spec.lap

# Search for related APIs
npx @lap-platform/lapsh search openrouter-api
```

## References
- Full spec: See references/api-spec.lap for complete endpoint details, parameter tables, and response schemas

> Generated from the official API spec by [LAP](https://lap.sh)
