Skip to content

OpenRouter

OpenRouter

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.

This tool uses an API key (API_KEY) to connect.

You will need the following fields:

FieldRequiredDescription
api_keyYesAPI key generated in the OpenRouter dashboard, used to authenticate all requests to the platform.
  1. Go to openrouter.ai and create an account or log in.
  2. After authenticating, navigate to openrouter.ai/keys.
  3. Click Create Key, give the key a descriptive name (e.g., “SquadOS”), and confirm.
  4. Copy the value displayed — it is only shown once.
  1. Go to Tools in the side menu (/admin/tools).
  2. Open the Available tab and search for OpenRouter.
  3. Click the card to open the details and hit Connect.
  4. You’re taken to the secure connection page hosted by Composio, where you enter the API key obtained above.
  5. Once done, you’re sent back to SquadOS with the account connected and the tool available to agents. (Connection-flow details in Organization Tools.)

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.

NameTypeRequiredDescription
nintegerNoNumber of completion choices to generate.
stopstringNoSequences where the API will stop generating further tokens.
userstringNoA unique identifier for the end-user to help detect abuse.
modelstringYesID 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_pnumberNoNucleus sampling probability, between 0 and 1.
streambooleanNoWhether to stream back partial message deltas.
messagesarrayYesList of conversation messages to provide as context.
functionsarrayNoList 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_biasobjectNoAdjust the likelihood of specified tokens.
max_tokensintegerNoMaximum number of tokens to generate.
temperaturenumberNoSampling temperature to use, between 0 and 2.
function_callstringNoControl function call behavior: none, auto, or specify {'name': function_name}.
presence_penaltynumberNoPenalty for new tokens based on presence in the text so far.
frequency_penaltynumberNoPenalty for new tokens based on frequency in the text so far.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
amountnumberYesAmount in USD to charge. This will be converted to the equivalent crypto amount.
senderstringYesEthereum wallet address of the sender (must be a valid 42-character hex address starting with 0x).
X_TitlestringNoThe app display name that customizes how your app appears in OpenRouter’s dashboard.
chain_idintegerYesBlockchain chain ID to use for the transaction. Options: 1 (Ethereum), 137 (Polygon), 8453 (Base).
HTTP_RefererstringNoThe app identifier (your app’s URL) used as the primary identifier for rankings and to track API usage per application.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
userstringNoUnique identifier for the end-user (max 128 characters).
modelstringYesModel identifier to use for generation. Example: anthropic/claude-4.5-sonnet-20250929.
toolsarrayNoList of tools available for the model to call.
top_kintegerNoTop-k sampling parameter.
top_pnumberNoNucleus sampling probability between 0 and 1.
modelsarrayNoList of fallback models to use if primary model fails.
streambooleanNoWhether to stream the response. Default false.
systemstringNoSystem message to guide model behavior.
pluginsarrayNoPlugins to enable for this request.
x_titlestringNoApp display name for OpenRouter dashboard.
messagesarrayYesList of conversation messages. Each message has a role (user or assistant) and content.
metadataobjectNoMetadata for the request.
providerobjectNoProvider routing preferences.
thinkingobjectNoConfiguration for extended thinking.
max_tokensintegerYesMaximum number of tokens to generate in the response.
session_idstringNoUnique identifier for grouping related requests (max 128 characters).
temperaturenumberNoSampling temperature between 0 and 2.
tool_choiceobjectNoTool choice configuration.
http_refererstringNoApp URL identifier used for tracking API usage per application.
service_tierstringNoService tier for the request. Options: auto or standard_only.
output_configobjectNoConfiguration for controlling output behavior.
stop_sequencesarrayNoSequences where generation should stop.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

OPENROUTER_GET_CURRENT_KEY

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

NameTypeRequiredDescription
x_titlestringNoThe app display name allows you to customize how your app appears in OpenRouter’s dashboard.
http_refererstringNoThe 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.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
idstringYesUnique identifier of the generation to retrieve.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
x_titlestringNoThe app display name allows you to customize how your app appears in OpenRouter’s dashboard.
http_refererstringNoThe 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.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
use_rssbooleanNoReturn RSS XML feed instead of JSON (BETA).
categorystringNoValid categories for filtering models. Options: programming, roleplay, marketing, marketing/seo, technology, science, translation, legal, finance, health, trivia, academia.
use_rss_chat_linksbooleanNoUse chat URLs instead of model page URLs in RSS items (only applies when use_rss=true) (BETA).
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
X-TitlestringNoThe app display name allows you to customize how your app appears in OpenRouter’s dashboard.
HTTP-RefererstringNoThe 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.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
slugstringYesModel’s unique slug under the author namespace (e.g., gpt4).
authorstringYesModel 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.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
x_titlestringNoThe app display name allows you to customize how your app appears in OpenRouter’s dashboard.
http_refererstringNoThe 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.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.

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.

NameTypeRequiredDescription
x_titlestringNoThe app display name allows you to customize how your app appears in OpenRouter’s dashboard.
http_refererstringNoThe 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.
NameTypeRequiredDescription
datastringYesData from the action execution.
errorstringNoError message if execution failed.
successfulbooleanYesWhether the action executed successfully.