Openrouter API

Give your agents access to Openrouter API. Bring your own Openrouter key, or skip the signup and pay per call from your Composio balance with Composio Instant.

Openrouter logoOpenrouter
Instant

OpenRouter is a unified API platform for accessing language models from various providers. It lets you easily integrate and switch between multiple LLMs with a single API.

122 Tools
COMPOSIO INSTANT

What is Composio Instant?

Composio Instant lets your agent use paid APIs like Openrouter without a separate account or API key for each one. New accounts start with $2 of free credit.

No Openrouter account or key

Your agent calls Openrouter through Composio, so there is nothing to sign up for, store, or rotate.

Pay per call, at cost

Billed at the selected model's OpenRouter token rate, from $0.02 per 1M input tokens and $0.04 per 1M output tokens; capped at $2 per call, paid from your Composio balance with zero markup.

Works in any agent

Claude, ChatGPT, Cursor, and other MCP clients, or your own code with the Composio SDK.

Works with your apps

Use Openrouter with Gmail, Slack, Google Sheets, and 1,700+ other apps you connect.

AI ASSISTANTS

Connect the Openrouter API to your AI assistant

Use Openrouter from the AI assistant you already work in. Connect Composio once, then paste the prompt.

  1. 1

    Open the Connectors menu

    Use the button to open Claude's Add connector dialog with Composio filled in. Or click + in the message box, then Connectors, Add connector and Add custom connector.
    Add Composio to Claude
  2. 2

    Add the Composio MCP server

    Name it Composio, paste the MCP server URL and click Add.
    https://connect.composio.dev/mcp
  3. 3

    Authorize in your browser

    A browser window opens. Sign in to Composio to approve the connection.
  4. 4

    Paste the prompt

    Start a new chat and paste the prompt. Claude runs the call on Composio Instant.
  1. 1

    Install the Composio plugin

    Open Composio's plugin page in ChatGPT and click Install. Sign in to ChatGPT first if it asks.
    Install in ChatGPT
  2. 2

    Authorize in your browser

    Connect the plugin, then sign in to Composio to approve the connection.
  3. 3

    Turn on Composio in your chat

    In a new chat, click +, then More, and select Composio.
  4. 4

    Paste the prompt

    Paste the prompt into that chat. ChatGPT runs the call on Composio Instant.
  1. 1

    Install the Composio plugin

    Open Composio in the Cursor marketplace, click Install Composio Plugin for Cursor and approve the connection in your browser.
    Install in Cursor
  2. 2

    Paste the prompt

    Open the Agent chat and paste the prompt. Cursor runs the call on Composio Instant.
  1. 1

    Add the Composio plugin

    Open Composio's listing on x.ai and click Add to Grok Bot. When Grok Bot opens the plugin, click Add.
    Add to Grok Bot
  2. 2

    Authenticate

    Go to Installed, open Composio and click Authenticate. Sign in to Composio and click Authorize.
  3. 3

    Paste the prompt

    Paste the prompt into your bot's chat. Grok Bot runs the call on Composio Instant.
  1. 1

    Paste the setup prompt

    Copy this into your Hermes chat. Hermes adds the Composio MCP server for you.
    Set up Composio from composio.dev/hermes
  2. 2

    Authorize in your browser

    A browser window opens. Sign in to Composio to approve the connection.
  3. 3

    Paste the prompt

    Start a new chat and paste the prompt. Hermes runs the call on Composio Instant.
ClaudeNew chat

Paste this prompt

Use OpenRouter through Composio Instant to summarize the main idea of photosynthesis in three sentences. Return the summary.

What success looks like

OPENROUTER_CREATE_CHAT_COMPLETION

Your assistant runs OpenRouter and replies with a three-sentence summary of the main idea of photosynthesis.

Runs on Composio Instant
SDK

Use the Openrouter API in your code

Call Openrouter from your own agent with the Composio SDK. Four steps and one tool call.

  1. 1

    Set up Composio

    Turn on Instant Toolkits in your project settings and check your prepaid balance in Billing. Then set your API key.
    export COMPOSIO_API_KEY="your_composio_api_key"
  2. 2

    Install the SDK

    The Python SDK needs Python 3.11 through 3.15.
    pip install composio
  3. 3

    Run the call

    Create a session that keeps Instant to this toolkit and reports the charge, then run the tool on the Instant account.
    OPENROUTER_CREATE_CHAT_COMPLETION
  4. 4

    Read the response

    When the call runs on Instant, the response includes its charge: the amount as an exact USD decimal string, the currency and charged_by.
agent.py
from composio import Composio

composio = Composio()

session = composio.sessions.create(
    user_id="user_123",
    toolkits=["openrouter"],
    instant={
        "toolkits": {"enable": ["openrouter"]},
        "return_instant_charge": True,
    },
)

result = session.execute(
    "OPENROUTER_CREATE_CHAT_COMPLETION",
    arguments={
        "model": "openai/gpt-4o-mini",
        "messages": [
            {
                "role": "user",
                "content": "Summarize the main idea of photosynthesis in three sentences.",
            },
        ],
        "max_tokens": 120,
    },
    account="instant_account",
)
print(result)
print("Instant charge:", result.instant_charge)
TOOLS

Available Openrouter API tools

1 Openrouter tool runs on Instant, priced per call with no Openrouter key. Tools marked Your key need your own Openrouter account.

ActionTool slugWhat it doesAvailability
Create Chat CompletionOPENROUTER_CREATE_CHAT_COMPLETIONGenerate a chat completion from messages and a selected model.
InstantBilled at the selected model's OpenRouter token rate, from $0.02 per 1M input tokens and $0.04 per 1M output tokens; capped at $2 per call
Create EmbeddingsOPENROUTER_CREATE_EMBEDDINGSCreate vector embeddings from text, tokens, or multimodal inputs.Your key
Generate ImageOPENROUTER_GENERATE_IMAGEGenerate an image from a text prompt.Your key
Create SpeechOPENROUTER_CREATE_SPEECHSynthesize speech from text or multi-speaker turns.Your key
Transcribe AudioOPENROUTER_CREATE_TRANSCRIPTIONConvert audio into text with an OpenRouter speech-to-text model.Your key
Generate VideoOPENROUTER_CREATE_VIDEO_GENERATIONSubmit an asynchronous video generation job to OpenRouter.Your key

Instant prices are Openrouter's list prices with 0% markup, paid from your Composio balance and updated every hour. Instant calls also count toward your plan's tool calls. See all plans on the pricing page.

USE CASES

Openrouter API use cases and example prompts

Copy a prompt into your agent. Each one uses Openrouter with apps you connect through Composio.

  • Turn release notes into a launch brief

    Use OpenRouter to turn the merged pull request descriptions in my Acme release on GitHub into customer-facing release notes. Save the draft in my Release Notes doc in Google Docs.

    Apps used: Openrouter, GitHub, Google Docs

  • Summarize customer feedback

    Use OpenRouter to review the support themes and customer comments in my Feedback Tracker in Google Sheets. Add a summary of recurring issues and suggested product fixes to the sheet, then post the main themes in Slack's #product channel.

    Apps used: Openrouter, Google Sheets, Slack

  • Draft an account follow-up

    Use OpenRouter to draft a follow-up based on the account notes and recent activity in the Acme company record in HubSpot. Create a Gmail draft that summarizes the relevant context and asks about next steps.

    Apps used: Openrouter, HubSpot, Gmail

  • Build a support knowledge page

    Use OpenRouter to turn the setup guide and troubleshooting notes in my Acme Launch folder in Google Drive into a support knowledge base page. Save the page in my Customer Support Handbook in Notion, with steps grouped by issue.

    Apps used: Openrouter, Google Drive, Notion

TROUBLESHOOTING

Openrouter API troubleshooting

Still stuck? The Instant tools docs cover limits, charges and session settings.

Start with Openrouter.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Openrouter tool your agent needs.Free to start.

Start building