OP Inference

Run text tasks, saved chat presets and public multi-model workflows on one AI gateway, billed to prepaid credits.

Hosted MCP Server

npx add-mcp 'https://api.opinference.com/v1/mcp'

Installs into Claude Code, Codex, Cursor and more

Documentation

MCP

Give an MCP client your tasks, your presets and the workflow gallery as tools, billed exactly as a direct call.

OP Inference serves the Model Context Protocol at https://api.opinference.com/v1/mcp. An MCP client pointed there with your API key sees your tasks, your presets and the workflow gallery as tools, and each tool call is served by the same route you would call directly.

Connect a client

The endpoint is stateless HTTP: one JSON-RPC request per POST, with no session and no event stream. Authenticate every request with your key as a bearer token, as on every other route.

{
  "mcpServers": {
    "opinference": {
      "type": "http",
      "url": "https://api.opinference.com/v1/mcp",
      "headers": { "Authorization": "Bearer ${OP_API_KEY}" }
    }
  }
}

Connect by signing in

Clients that support OAuth (Claude, ChatGPT, Cursor, Claude Code) can connect without a key. Add https://api.opinference.com/v1/mcp as a custom connector, or omit headers above. The client opens a page on the console where you sign in, choose the workspace the app works in and set its monthly spend cap ($20.00 unless you change it), then select Allow.

Allowing creates an API key for that app in the chosen workspace, named after the app. Its usage, spend cap and last use show on API keys like any other key, and you can change the cap there. To disconnect, open Settings, then Connected apps, and select Revoke. Revoking the app revokes its key, and the app's next call is refused within about a minute.

Protocol versions 2026-07-28, 2025-11-25 and 2025-06-18 are supported. A client on an older revision starts with initialize, which answers the version it asked for when that is 2025-11-25 or 2025-06-18 and 2025-11-25 otherwise; a 2026-07-28 client uses server/discover.

A request that carries an Origin header is refused with 403, so a browser page cannot call the endpoint with a key it has obtained. Call it from a server, a desktop client or an agent runtime.

Tools

ToolWhat it callsArguments
task.<name>POST /v1/tasks/<name>, the task's latest versionThe task's input object. inputSchema and outputSchema are the task's schemas
preset.<slug>POST /v1/chat/completions with model @preset/<slug>prompt, the user message; and variables, when the preset declares any
gallery.searchThe gallery index, read on the nodequery, matched against handle, slug, title and description; category, agent or workflow; limit, 1 to 20
gallery.describeOne listingname such as @acme/caption; version, optional
gallery.runPOST /v1/workflows/@<handle>/<slug>/runsname, version, input, max_cost_usd (required), wait_s (0 to 45, default 30)
gallery.get_runGET /v1/runs/<id>id; wait_s (0 to 45, default 0)

tools/list shows only the tasks your key may call, the same list as GET /v1/tasks, and only your own tenant's presets. A task tool's result carries the checked output as structuredContent and as text; a preset tool's result is the assistant's text. The gallery tools are listed whenever the gallery has at least one listing.

On protocol 2026-07-28, tools/list also answers ttlMs: 60000 and cacheScope: "private": your client may reuse the list for a minute, for your key only. A task you were just granted, or a preset you just saved, can take up to that minute to appear.

Every tool has a title and the annotations readOnlyHint, destructiveHint, idempotentHint and openWorldHint. The search, describe and run-reading tools are read-only, so a client may run them without asking. Task, preset and gallery.run calls spend credits, so they are not read-only and a client asks before each one. Annotations are hints to your client, not a limit on spend.

Run a gallery workflow

Search, describe, then run:

  1. gallery.search with a few words returns matching public listings, each with its author, its category and the price of its example run. A listing is an agent when at least one step calls tools in a loop until it answers, otherwise a workflow; pass category: "agent" to find only agents. Unlisted listings never appear here.
  2. gallery.describe returns the listing's input schema, its own cost cap and each step's model. It never returns a step's prompt.
  3. gallery.run starts the run with your input and a max_cost_usd of your choosing, as a direct run does, then waits up to wait_s seconds for it to finish. The result is the run resource: when it is still queued or processing, call gallery.get_run with its id to read it again.

A run that fails or is canceled comes back with isError: true, its error code and message as text, and the run resource as structuredContent. Calling gallery.run twice starts two runs, each billed.

A call the route refuses or fails, such as a budget refusal or an output_invalid answer, comes back as a tool result with isError: true and text of the form <code>: <message>, so the model calling the tool can read why. An unknown tool name or arguments that are not an object are a JSON-RPC error -32602, and nothing is run. So is a preset call whose prompt is not a string, or whose variables do not name exactly the preset's declared variables, each as a string.

Billing

Listing tools, ping, initialize, server/discover, gallery.search, gallery.describe and gallery.get_run are free. A tool call is admitted, routed, billed and retained exactly as the direct call would be: your key's policy, budget, rate limit and retention class all apply, and the usage record names the task or preset as it would for the direct route. A task call that is repaired bills two generations, as described in Tasks.

An agent can call tools quickly. Your key's budget and rate limit are what bound its spend, so give an agent a key with a budget you are prepared for it to use.

Tool results are untrusted input

A tool result is model output, and it may carry text that reads as instructions, especially when the tool's input came from a third party. A gallery listing's title, description and author name are written by its author, not by OP Inference. Your agent receives all of it with your key's authority. Treat it as data, as you would any other response from this API.

[

Tasks

Call a ready-made task, such as sentiment or receipt extraction, and get JSON that matches its schema.

](https://docs.opinference.com/docs/text/tasks)[

Fallbacks

Let other models answer when your first choice cannot.

](https://docs.opinference.com/docs/text/fallbacks)