openrouter-function-calling
Skill by jeremylongshore
Implements function and tool calling with OpenRouter models. It is for developers building agents, structured output, or tool-augmented LLM workflows.
Install openrouter-function-calling
Built from the published package, never by AI.
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.claude/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-function-calling ~/.claude/skills/openrouter-function-callingRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install openrouter-function-calling in Claude Code
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/openrouter-function-calling ~/.gemini/antigravity-cli/skills/openrouter-function-callingAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install openrouter-function-calling in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill shows how to add function and tool calling to an app that uses OpenRouter models. Tools are defined as JSON Schema and sent with a request. The model then returns structured tool_calls instead of free text. The source says OpenRouter normalizes this interface, so the same code can work across providers that support tool calling.
The skill covers basic tool calling in Python and TypeScript, a multi-turn loop that runs tools until the model returns plain text, and JSON mode for structured output without tools. It also includes a model compatibility table and an error handling table. It is aimed at developers building agents or extraction pipelines on OpenRouter.
Written from the project's SKILL.md and checked against it.
What it can do
- Basic tool callingDefines tools as JSON Schema and reads the model's tool_calls response.
- Multi-turn tool loopRuns tool calls in a loop until the model returns a text response, bounded by max_rounds.
- TypeScript tool callingShows the same tool calling flow in Node with the OpenAI SDK.
- Structured outputUses JSON mode to get parseable JSON without tool calling.
- Model compatibility tableLists which example models support tool calling, JSON mode and parallel tools.
What you need
- OpenRouter API key
- Python 3.8+ or Node.js 18+
- OpenAI SDK
- A tool-capable model
Try asking
- Show me how to add a weather tool to my OpenRouter agent.
- Write a tool loop that runs functions until the model answers in text.
- Extract name, email and company as JSON using OpenRouter JSON mode.
Good to know
- The execute_tool() dispatcher stubs get_weather and search_database, so real functions are needed.
- Claude 3.5 Sonnet gets JSON output via system prompt and runs tools sequentially.
- Llama 3.1 70B tool calling varies and it does not support parallel tools.
- Models can hallucinate tool arguments, so the source recommends validating them before execution.
Security check
B- Allowed to use Write, Edit without limitsIn
SKILL.md
Checked automatically: skills/.curated/openrouter-function-calling/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: ReadWriteEditGrepBash(python3:*)Bash(node:*)
Alternatives to openrouter-function-calling
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
openrouter-function-calling: common questions
Which models support tool calling on OpenRouter?
The source lists openai/gpt-4o, openai/gpt-4o-mini, anthropic/claude-3.5-sonnet, google/gemini-2.0-flash-001 and meta-llama/llama-3.1-70b-instruct, with differing support for JSON mode and parallel tools. It recommends checking /api/v1/models for capabilities.
What should I do if the model does not call a tool?
The source says to use tool_choice set to "required" to force a tool call, for example in extraction pipelines.
Does the same code work across providers?
The source says OpenRouter normalizes the tool calling interface, so the same code works across providers that support it.
How do I install openrouter-function-calling?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is openrouter-function-calling free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is openrouter-function-calling safe to use?
It scores 74 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use write, edit without limits). Review the code before you install. How grades work.
What are alternatives to openrouter-function-calling?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
