# Openrouter

OpenRouter is a platform that provides a unified API for accessing various large language models (LLMs) from different providers, allowing developers to integrate multiple AI models seamlessly.

- **Category:** artificial intelligence
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 13
- **Triggers:** 0
- **Slug:** `OPENROUTER`
- **Version:** 20260316_00

## Tools

### Create Chat Completion

**Slug:** `OPENROUTER_CREATE_CHAT_COMPLETION`

Tool to generate a chat-style completion. Use after assembling messages and selecting a model. Supports streaming and function calls. Response format varies across models; use explicit prompt instructions to standardize output. Provider-level rate limits and moderation policies differ per model.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `n` | integer | No | Number of completion choices to generate. |
| `stop` | string | No | Sequences where the API will stop generating further tokens. |
| `user` | string | No | A unique identifier for the end-user to help detect abuse. |
| `model` | string | Yes | ID of the model to use for the chat completion. Must exactly match an ID returned by OPENROUTER_LIST_AVAILABLE_MODELS; typos or approximate names cause request failures. |
| `top_p` | number | No | Nucleus sampling probability, between 0 and 1. |
| `stream` | boolean | No | Whether to stream back partial message deltas. |
| `messages` | array | Yes | List of conversation messages to provide as context. |
| `functions` | array | No | List of functions the model may call. Only supported by models that explicitly advertise function-calling capability via OPENROUTER_LIST_AVAILABLE_MODELS. Each function schema must be valid JSON; malformed schemas cause runtime failures regardless of prompt correctness. |
| `logit_bias` | object | No | Adjust the likelihood of specified tokens. |
| `max_tokens` | integer | No | Maximum number of tokens to generate. |
| `temperature` | number | No | Sampling temperature to use, between 0 and 2. |
| `function_call` | string | No | Control function call behavior: 'none', 'auto', or specify {'name': function_name}. |
| `presence_penalty` | number | No | Penalty for new tokens based on presence in the text so far. |
| `frequency_penalty` | number | No | Penalty for new tokens based on frequency in the text so far. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Coinbase Charge

**Slug:** `OPENROUTER_CREATE_COINBASE_CHARGE`

Tool to create a Coinbase charge for crypto payment to add credits to your OpenRouter account. Use when you need to purchase credits using cryptocurrency. Returns calldata needed to fulfill the transaction on the specified blockchain.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `amount` | number | Yes | Amount in USD to charge. This will be converted to the equivalent crypto amount. |
| `sender` | string | Yes | Ethereum wallet address of the sender (must be a valid 42-character hex address starting with '0x'). |
| `X_Title` | string | No | The app display name that customizes how your app appears in OpenRouter's dashboard. |
| `chain_id` | integer ("1" | "137" | "8453") | Yes | Blockchain chain ID to use for the transaction. Options: 1 (Ethereum), 137 (Polygon), 8453 (Base). |
| `HTTP_Referer` | string | No | The app identifier (your app's URL) used as the primary identifier for rankings and to track API usage per application. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Create Message (Anthropic Format)

**Slug:** `OPENROUTER_CREATE_MESSAGE`

Tool to create a message using Anthropic Messages API format via OpenRouter. Use when you need Claude-compatible chat completion with support for text, images, PDFs, tools, and extended thinking.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `user` | string | No | Unique identifier for the end-user (max 128 characters). |
| `model` | string | Yes | Model identifier to use for generation. Example: 'anthropic/claude-4.5-sonnet-20250929'. |
| `tools` | array | No | List of tools available for the model to call. |
| `top_k` | integer | No | Top-k sampling parameter. |
| `top_p` | number | No | Nucleus sampling probability between 0 and 1. |
| `models` | array | No | List of fallback models to use if primary model fails. |
| `stream` | boolean | No | Whether to stream the response. Default false. |
| `system` | string | No | System message to guide model behavior. |
| `plugins` | array | No | Plugins to enable for this request. |
| `x_title` | string | No | App display name for OpenRouter dashboard. |
| `messages` | array | Yes | List of conversation messages. Each message has a role ('user' or 'assistant') and content. |
| `metadata` | object | No | Metadata for the request. |
| `provider` | object | No | Provider routing preferences. |
| `thinking` | object | No | Configuration for extended thinking. |
| `max_tokens` | integer | Yes | Maximum number of tokens to generate in the response. |
| `session_id` | string | No | Unique identifier for grouping related requests (max 128 characters). |
| `temperature` | number | No | Sampling temperature between 0 and 2. |
| `tool_choice` | object | No | Tool choice configuration. |
| `http_referer` | string | No | App URL identifier used for tracking API usage per application. |
| `service_tier` | string ("auto" | "standard_only") | No | Service tier for the request. |
| `output_config` | object | No | Configuration for controlling output behavior. |
| `stop_sequences` | array | No | Sequences where generation should stop. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Credits

**Slug:** `OPENROUTER_GET_CREDITS`

Tool to get the current API credit balance for the authenticated user. Use before large or batch jobs to verify sufficient balance. A successful response may return total_credits=0, which confirms authentication but will cause all paid model generations to fail. Avoid polling this endpoint; call only as needed.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Current Key

**Slug:** `OPENROUTER_GET_CURRENT_KEY`

Tool to get information about the currently authenticated API key. Use to check usage limits, spending, and key metadata.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `x_title` | string | No | The app display name allows you to customize how your app appears in OpenRouter's dashboard. |
| `http_referer` | string | No | The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Generation

**Slug:** `OPENROUTER_GET_GENERATION`

Tool to retrieve a generation result by its unique ID. Use after a generation completes to fetch metadata like token counts, cost, and latency.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | Yes | Unique identifier of the generation to retrieve. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Models Count

**Slug:** `OPENROUTER_GET_MODELS_COUNT`

Tool to get the total count of available models on OpenRouter. Use when you need to know how many models are available without fetching the full list.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `x_title` | string | No | The app display name allows you to customize how your app appears in OpenRouter's dashboard. |
| `http_referer` | string | No | The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Available Models

**Slug:** `OPENROUTER_LIST_AVAILABLE_MODELS`

Tool to list available models via OpenRouter API. Use after confirming authentication to fetch the model catalog. Use exact model IDs returned here in OPENROUTER_CREATE_CHAT_COMPLETION or OPENROUTER_CREATE_COMPLETION calls — hard-coded IDs may break when the catalog changes. Use exact author and slug values from this response as inputs to OPENROUTER_LIST_MODEL_ENDPOINTS. Models have varying capabilities (e.g., tools, reasoning); verify individual model capabilities before downstream use. Pricing and latency metadata may be null or approximate — handle missing values in routing logic.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `use_rss` | boolean | No | Return RSS XML feed instead of JSON (BETA). |
| `category` | string ("programming" | "roleplay" | "marketing" | "marketing/seo" | "technology" | "science" | "translation" | "legal" | "finance" | "health" | "trivia" | "academia") | No | Valid categories for filtering models. |
| `use_rss_chat_links` | boolean | No | Use chat URLs instead of model page URLs in RSS items (only applies when use_rss=true) (BETA). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Embedding Models

**Slug:** `OPENROUTER_LIST_EMBEDDING_MODELS`

Tool to list all available embeddings models via OpenRouter API. Returns a list of embeddings models with their properties including architecture, pricing, and capabilities.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `X-Title` | string | No | The app display name allows you to customize how your app appears in OpenRouter's dashboard. |
| `HTTP-Referer` | string | No | The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### OpenRouter List Model Endpoints

**Slug:** `OPENROUTER_LIST_MODEL_ENDPOINTS`

Tool to list endpoints for a specific model. Use after specifying model author and slug to get endpoint details including pricing, context length, and supported parameters. Some metadata fields (e.g., latency, pricing) may be null or approximate; handle missing values in routing logic.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `slug` | string | Yes | Model's unique slug under the author namespace (e.g., 'gpt4'). |
| `author` | string | Yes | Model author's username as it appears in the model URL (e.g., 'anon'). Use exact value from OPENROUTER_LIST_AVAILABLE_MODELS — approximate or incorrect values return empty results. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### OpenRouter List Providers

**Slug:** `OPENROUTER_LIST_PROVIDERS`

Tool to list all AI model providers available through the OpenRouter API. Use after authentication to retrieve available provider options for routing configuration. Providers differ in latency, context window sizes, and rate limits — switching providers affects these constraints. Newly added providers may not appear immediately due to catalog propagation delays.

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List User Models

**Slug:** `OPENROUTER_LIST_USER_MODELS`

Tool to list models filtered by user provider preferences, privacy settings, and guardrails. Use after authenticating to get models tailored to the user's configuration.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `x_title` | string | No | The app display name allows you to customize how your app appears in OpenRouter's dashboard. |
| `http_referer` | string | No | The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### OpenRouter List ZDR Endpoints

**Slug:** `OPENROUTER_LIST_ZDR_ENDPOINTS`

Tool to preview the impact of Zero Data Retention (ZDR) on the available endpoints. Use to see which model endpoints remain accessible when ZDR is enabled.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `x_title` | string | No | The app display name allows you to customize how your app appears in OpenRouter's dashboard. |
| `http_referer` | string | No | The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
