# Dify

Import an OpenAPI schema for discover, inspect and run as a Dify custom tool, then use the catalog from Dify agents and workflows.

|  |  |
| --- | --- |
| Kind | workflow |
| Connects through | rest |
| Docs | <https://docs.dify.ai/en/guides/tools> |

## Install

1. In Dify, open Tools, choose Custom and create a custom tool.
2. Paste the schema below as the tool's OpenAPI schema.
3. Set authentication to an API key sent as a Bearer token in the `Authorization` header, with your OrcaRouter API key, and save.
4. Add the tool to an agent or a workflow: the model calls discoverTools, reads the input schema with inspectTool, then calls runTool.

## Code

### OpenAPI schema

```yaml
openapi: 3.0.1
info:
  title: OrcaRouter tools
  version: "1.0"
servers:
  - url: https://api.orcarouter.ai
paths:
  /v1/tools/discover:
    post:
      operationId: discoverTools
      summary: Find tools in the OrcaRouter catalog for a task
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [q]
              properties:
                q:
                  type: string
                  description: What the tool should do, for example "tiktok user profile"
                limit:
                  type: integer
                  description: How many tools to return, at most 10
      responses:
        "200":
          description: Matching tools with their ids and prices
  /v1/tools/{id}:
    get:
      operationId: inspectTool
      summary: Read one tool's description and input schema
      parameters:
        - name: id
          in: path
          required: true
          description: A tool id returned by discoverTools
          schema:
            type: string
      responses:
        "200":
          description: The tool, with its input_schema
  /v1/tools/{id}/run:
    post:
      operationId: runTool
      summary: Run one tool with an input that matches its input schema
      parameters:
        - name: id
          in: path
          required: true
          description: A tool id returned by discoverTools
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [input]
              properties:
                input:
                  type: object
                  description: The tool's input, matching its input_schema
      responses:
        "200":
          description: The tool's output and what the call cost
```

## Recipes

- [Track competitor TikTok accounts](https://www.orcarouter.ai/tools/recipes/track-competitor-tiktok-accounts.md): Pull each competitor's TikTok profile, find its latest videos and read what viewers say, in three tool calls an agent can repeat every week.
- [Monitor brand mentions on the web and TikTok](https://www.orcarouter.ai/tools/recipes/monitor-brand-mentions.md): Search the web and TikTok for your brand, then read the comments under the posts that mention it: a daily brand check an agent can run on its own.
- [Enrich a lead list](https://www.orcarouter.ai/tools/recipes/enrich-a-lead-list.md): Turn a list of company domains into firmographics, a contact's work email and a recent news hook, with one API key.

## Related integrations

- [n8n](https://www.orcarouter.ai/tools/integrations/n8n.md): Call discover and run from n8n's HTTP Request node, with your OrcaRouter key as a header credential, to put catalog tools into any workflow.
- [LangChain](https://www.orcarouter.ai/tools/integrations/langchain.md): Load OrcaRouter tools as LangChain tools from the functions export and give them to any LangChain agent; each call runs the tool through OrcaRouter.
- [CrewAI](https://www.orcarouter.ai/tools/integrations/crewai.md): Give a CrewAI agent the OrcaRouter tool catalog through MCPServerAdapter, so it can find and run tools while it works on a task.

---

Markdown version of https://www.orcarouter.ai/tools/integrations/dify
