monid-ai/monid

Monid - OpenRouter for agent tools. Join our community at https://discord.gg/rQzztcgJV8

Monid – an OpenRouter‑style catalog for AI‑agent tools

What it is – Monid is a declarative framework that lets AI agents discover and invoke 2 000+ external tools (search, enrichment, media generation, etc.) from dozens of providers through a single base URL and API key. The repository contains the connector layer: a set of type‑safe, YAML‑like definitions that describe each provider’s endpoints, authentication, and per‑call pricing model.

Why it matters – Agents often need to call many third‑party APIs, but each service has its own URL, auth scheme, and billing rules. Monid abstracts all of that into a unified catalog, automatically ranks the best endpoint for a request, and reports the exact usage cost before the response is processed. This makes tool selection dynamic, transparent, and cost‑aware.


Core concepts

Concept What it does
Provider Declares a service’s identity, auth method, and usage model (free, per‑call, per‑token, etc.).
Endpoint Describes a single API operation: HTTP method, path, input schema (via zod), time‑outs, and metadata used for discovery.
Resource (optional) For durable assets (e.g., a phone‑number lease) – defines lifecycle hooks and a separate rate card.
discover Free verb that ranks every endpoint across all providers for a given job, returning price, health, and latency hints.
inspect Free verb that returns the full contract of a chosen endpoint.
run Billed verb that actually executes the request, settles usage on the raw response, and maps the output to the declared schema.

How an agent uses Monid

  1. Fetch the skill file – https://monid.ai/SKILL.md gives the agent the three verbs and the catalog URL.
  2. Discover – Call discover with a task description; Monid returns a ranked list of candidate endpoints with pricing.
  3. Inspect – Pull the full contract of the chosen endpoint to know required parameters.
  4. Run – Execute the call; Monid records usage according to the provider‑defined model and returns the validated result.

Adding a new tool (connector)

  1. Create a provider.ts using defineProvider (name, meta, auth, usage).
  2. Add one or more endpoint.ts files under connectors/<provider>/endpoints/<name>/ with request details and Zod input schemas.
  3. (Optional) Add a resource definition for owned assets.
  4. Record a fixture (deno task record) and write a replay test (endpoint.test.ts).
  5. Run deno task check && deno task test – tests must pass without network access.
  6. Open a PR; once merged the new endpoint appears in discover for all agents.

Quick‑start (requires Deno 2.x)

git clone https://github.com/monid-ai/monid.git
cd monid
# Verify types and run the fixture‑based test suite
 deno task check && deno task test
# Run a real endpoint (example: TinyFish web search)
export TINYFISH_CREDENTIALS_API_KEY=YOUR_KEY
 deno task engine:run 'tinyfish#search' \
   --query-params '{"query":"solid-state battery suppliers","domain_type":"news"}'
# Browse the catalog
 deno task catalog providers
 deno task catalog endpoints --provider exa
 deno task catalog inspect 'exa#search'

Architecture snapshot

  • Connectors – declarative TypeScript files that compile to a JSON‑compatible contract.
  • Compiler – turns the definitions into a single sealed bundle; functions are interned by content hash for tamper‑evidence.
  • Engine – validates input, builds the HTTP request, injects credentials, settles usage on the raw response, maps output, and validates the final payload.
  • CLI scripts – catalog, engine:run, record, etc., provide local development, testing, and production execution.
  • Testing harness – fixtures store trimmed real responses; replay tests run offline, while live tests run only when credentials are present.

Who should use it

  • AI‑agent developers who need a plug‑and‑play catalog of external tools with unified billing.
  • Tool providers who want their APIs listed without writing custom integration code.
  • Ops teams that need transparent per‑call cost tracking for agents.

License

MIT (see LICENSE).

Related

  • Project
  • Project
  • Project
  • Project