OpenRouter
Overview
Section titled “Overview”OpenRouter is a platform that provides a unified API for accessing various large language models (LLMs) from different providers, allowing developers to integrate and switch between AI models seamlessly. With the OpenRouter integration in SquadOS, your agents can generate chat completions, query model catalogs, check credit balances, and route requests to the most suitable provider.
- Official website: https://openrouter.ai/
- Composio documentation: docs.composio.dev/toolkits/openrouter
Authentication
Section titled “Authentication”This tool uses an API key (API_KEY) to connect.
You will need the following fields:
| Field | Required | Description |
|---|---|---|
api_key | Yes | API key generated in the OpenRouter dashboard, used to authenticate all requests to the platform. |
How to get credentials
Section titled “How to get credentials”- Go to openrouter.ai and create an account or log in.
- After authenticating, navigate to openrouter.ai/keys.
- Click Create Key, give the key a descriptive name (e.g., “SquadOS”), and confirm.
- Copy the value displayed — it is only shown once.
How to connect in SquadOS
Section titled “How to connect in SquadOS”- Go to Tools in the side menu (
/admin/tools). - Open the Available tab and search for
OpenRouter. - Click the card to open the details and hit Connect.
- You’re taken to the secure connection page hosted by Composio, where you enter the API key obtained above.
- Once done, you’re sent back to SquadOS with the account connected and the tool available to agents. (Connection-flow details in Organization Tools.)
Available actions
Section titled “Available actions”Create Chat Completion
Section titled “Create Chat Completion”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
Section titled “Input parameters”| Name | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
Create Coinbase Charge
Section titled “Create Coinbase Charge”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
Section titled “Input parameters”| Name | 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 | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
Create Message (Anthropic Format)
Section titled “Create Message (Anthropic Format)”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
Section titled “Input parameters”| Name | 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 | No | Service tier for the request. Options: auto or standard_only. |
output_config | object | No | Configuration for controlling output behavior. |
stop_sequences | array | No | Sequences where generation should stop. |
Output
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
Get Credits
Section titled “Get Credits”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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
Get Current Key
Section titled “Get Current Key”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
Section titled “Input parameters”| Name | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
Get Generation
Section titled “Get Generation”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
Section titled “Input parameters”| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique identifier of the generation to retrieve. |
Output
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
Get Models Count
Section titled “Get Models Count”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
Section titled “Input parameters”| Name | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
List Available Models
Section titled “List Available Models”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
Section titled “Input parameters”| Name | Type | Required | Description |
|---|---|---|---|
use_rss | boolean | No | Return RSS XML feed instead of JSON (BETA). |
category | string | No | Valid categories for filtering models. Options: programming, roleplay, marketing, marketing/seo, technology, science, translation, legal, finance, health, trivia, academia. |
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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
List Embedding Models
Section titled “List Embedding Models”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
Section titled “Input parameters”| Name | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
List Model Endpoints
Section titled “List Model Endpoints”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
Section titled “Input parameters”| Name | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
List Providers
Section titled “List Providers”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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
List User Models
Section titled “List User Models”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
Section titled “Input parameters”| Name | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |
List ZDR Endpoints
Section titled “List ZDR Endpoints”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
Section titled “Input parameters”| Name | 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
Section titled “Output”| Name | Type | Required | Description |
|---|---|---|---|
data | string | Yes | Data from the action execution. |
error | string | No | Error message if execution failed. |
successful | boolean | Yes | Whether the action executed successfully. |