Skip to main content
Tools for any OpenRouter model Give any OpenRouter model web search and page fetch as tools. The model decides when to search, your code runs the call, and each result comes back with the page text already extracted. You don’t need a Keenable key to start, so each example below runs with only an OpenRouter key. The examples use deepseek/deepseek-v4.1-flash. Any OpenRouter model that supports tool calling works. Set OPENROUTER_API_KEY first.

Python

This loop sends the question, runs each tool call the model makes, and prints the answer once the model stops calling tools:
TOOLS holds OpenAI-format definitions for keenable_search and keenable_fetch. run_tool_call runs whichever one the model picked and returns a numbered, citable block for the tool message, so the model can cite a fetched page the same way it cites a search result. Filters, async and errors are in the SDK reference.

TypeScript, AI SDK

Pass keenableTools() to generateText with an OpenRouter model:
stopWhen lets the model search, read the results and then answer. Without it, generateText stops after the first step and returns only the tool call. The same tools work in streamText. To keep the key out of environment variables on Vercel, see Vercel.

OpenRouter Agent SDK, MCP

Connect to the Keenable MCP server and pass its tools to callModel:
createMCPTools reads the tool list from the Keenable MCP server and runs the calls, so there is no tool code to write. To use your key, pass it as a header:

Use your API key

Set KEENABLE_API_KEY to remove the hourly request cap. If you don’t set a key, calls run on the shared keyless tier, which allows 1,000 requests per hour per IP address. See Rate limits.
The Python SDK and @keenable/ai-sdk read KEENABLE_API_KEY from the environment. The MCP client takes it as the header above. Create a key in the Keenable console.

Billing

OpenRouter bills the model’s tokens, including the search results the model reads. Keenable bills its calls separately against your Keenable credits. Without a key, the calls run on the public tier. This setup is separate from OpenRouter’s own openrouter:web_search server tool: Keenable runs as your tool, so it behaves the same on every model and every call goes through your code.