Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 74
  • 3k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

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-calling

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install openrouter-function-calling in Claude Code

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 →

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.

openrouter-function-calling Install

Add to stack

Loading.