Menu

Mattering Automations OpenRouter integration

Connect OpenRouter to Mattering Automations: chat completions against hundreds of models with fallback lists and provider routing, the model catalog with per-token prices, key limits, and per-generation cost audits as workflow steps, authenticated with an OpenRouter API key.

The Mattering Automations OpenRouter integration adds OpenRouter to your automation canvas: run chat completions against any model in OpenRouter's catalog through one OpenAI-compatible request, with fallback model lists that fall through in order when a model is down or over quota and provider routing preferences that control which upstream providers serve the call. Alongside the chat node sit five free reads: the model catalog with OpenRouter's per-token prices, per-model provider endpoints, the provider directory, the key's own limits and usage, and a per-generation cost audit.

Setup takes a few minutes: create an API key in your OpenRouter settings, attach it as a credential in Mattering, and test the connection. This guide walks through each step and ends with the full node reference.

Cost visibility is built in rather than bolted on. Every response from OpenRouter: Chat Completion automatically carries data.usage.cost, the USD amount charged for the call, and OpenRouter: Get Generation turns any completion's id into a full billing record: exact total cost, token counts, the provider that served it, and latency. Only the chat node spends money; the other five nodes are free to call.

Before you start

  • An OpenRouter account (openrouter.ai).
  • Prepaid credits on the account for chat completions, which bill per token at the routed model's price. The five read nodes are free, so you can connect and verify before buying anything.
  • A Mattering workspace with access to the Automations app.

Create an OpenRouter API key

Mattering authenticates to OpenRouter with an API key, sent as a bearer credential on every request. Keys are created in the OpenRouter settings and there is no OAuth flow involved.

Open your OpenRouter settings and go to Keys (openrouter.ai/settings/keys).
Create a new API key and copy it.
Create an ordinary inference key, not a management or provisioning key. Management keys unlock OpenRouter's admin surfaces (key administration, credits, analytics), which this integration deliberately does not ship; the credential you store here is the key your completions bill against.

Connect OpenRouter to Mattering

In Mattering Automations, open Connectors and click Add Connector.
Choose OpenRouter from the list.
Click Create new credential, paste your API key, and save.
The credential is stored encrypted in Google Secret Manager and never appears in workflow logs.
Click Test Connection: Mattering reads the key's own record, a free call that returns the key's credit limit, remaining limit, and usage totals. The key label in the response is masked; full key material is never returned.
Click Connect. All 6 OpenRouter nodes appear in your canvas palette.

Verify it works

After connecting, open any automation canvas and check the palette: an OpenRouter section should list the query and action nodes. Drop OpenRouter: Get Current API Key onto the canvas and run a test step. It takes no parameters, costs nothing, and a successful response shows the key's limit, limit_remaining, and usage totals, which confirms the credential end to end. Do not rely on OpenRouter: List Models as a credential check: OpenRouter serves the catalog without authentication, so it succeeds even with a broken key.

To exercise the paid path cheaply, run OpenRouter: Chat Completion with a short prompt on an inexpensive model (the catalog includes free variants with tight rate limits) and a small completion-token cap, then feed the response's data.id into OpenRouter: Get Generation to see the exact cost, token counts, serving provider, and latency for the call. The whole verification pass costs well under a cent.

Node reference

6 nodes, generated from the connector itself so this reference always matches what ships.

Read and query nodes 5

OpenRouter: Get Current API Key

openrouter_get_key

Read the limits and usage of the API key making the call: data.limit and data.limit_remaining (USD credit limit, null when unlimited), usage totals for the current day, week, and month, the free-tier flag, and a masked display label. It never returns the full key material. Free to call and read-only, which makes it the connector's credential health check: a bad key gets a 401, a good key gets a 200 at no cost. The endpoint takes no parameters, so the config panel is intentionally empty.

OpenRouter: Get Generation

openrouter_get_generation

Fetch the full billing and performance record for one completed generation by id (the data.id returned by the chat node): data.data carries total_cost in USD, native and normalized token counts (prompt, completion, reasoning, cached), any cache_discount, the provider_name that actually served it, generation_time and latency in milliseconds, and the finish reason. Free to call; this is the cost-audit companion to every paid completion. Note: the record can lag the completion by a moment, so retry briefly on a 404 right after a call.

OpenRouter: Get Model Endpoints

openrouter_get_model_endpoints

List every provider endpoint serving one model: each entry at data.data.endpoints[] carries the provider_name, its own per-token pricing, context_length, max_completion_tokens, quantization, uptime, and recent latency/throughput percentiles. This is the data behind provider routing: use it to pick the order or only lists for the chat node's provider preferences. Free to call.

OpenRouter: List Models

openrouter_list_models

List the OpenRouter model catalog: each entry at data.data[] carries the model id (author/slug form, ready for the chat node), name, description, context_length, per-token USD pricing (pricing.prompt and pricing.completion), supported parameters, and modality info. Free to call. Honest probe note: this endpoint answers 200 even without authentication, so it cannot verify your key; use the Get Current API Key node for that.

OpenRouter: List Providers

openrouter_list_providers

List every upstream provider OpenRouter can route to: each entry at data.data[] carries the provider's name, slug (the value used in the chat node's provider order / only / ignore lists), headquarters and datacenter country codes, and links to its privacy policy, terms, and status page. Free to call. The endpoint takes no parameters, so the config panel is intentionally empty.

Action nodes 1

OpenRouter: Chat Completion

openrouter_chat_completion

Send a chat completion to any model on OpenRouter with one OpenAI-compatible request: pick the model by id (e.g. anthropic/claude-sonnet-4 or openai/gpt-5), optionally list fallback models and provider routing preferences, and read the answer at data.choices[0].message.content. Every response automatically includes data.usage.cost, the USD amount charged for the call, so downstream nodes can track spend per request. Billed per token at the routed model's price. Streaming is always off: the node returns one JSON response.

Using the integration

On the automation canvas

OpenRouter nodes chain with every other node: a comparison sweep can run one prompt across several models and write each answer with its cost as rows in a Mattering database, a content pipeline can draft into Mattering Productivity tasks with a fallback model list keeping it alive through provider outages, and a scheduled OpenRouter: Get Current API Key check can flag the team before credits run dry.

From AI assistants over MCP

Every node speaks MCP, the open protocol for connecting AI assistants to tools. Claude, ChatGPT, and Matter can browse the catalog with OpenRouter's per-token prices, compare the providers serving a model, run completions, and audit what each call cost, through the same nodes your workflows use. Five of the six nodes are free reads, which makes most of this surface safe to hand an agent.

Fallback models and provider routing

OpenRouter: Chat Completion takes a primary model id plus an optional fallback list; OpenRouter tries the ids in order when a model is down or over quota, and the response's data.model reports which one served. The provider preferences object controls the upstream side: order and only pin providers, ignore excludes them, and price sorting routes to the cheapest offer. Provider slugs come from OpenRouter: List Providers, and OpenRouter: Get Model Endpoints shows each provider's pricing, uptime, and latency percentiles for a model, which is the data those choices should rest on.

Cost accounting on every call

Every chat response carries data.usage.cost in USD automatically, with no opt-in. OpenRouter: Get Generation is the post-hoc audit: pass a completion's id and get the exact total cost, native and normalized token counts including reasoning and cached tokens, any cache discount, the serving provider, and generation time. OpenRouter: List Models carries OpenRouter's own per-token prices per model; the integration never invents prices, it surfaces OpenRouter's numbers.

Model ids are free text

The catalog holds hundreds of models and changes weekly, so the model field and the fallback list take ids as text in author/slug form (anthropic/claude-sonnet-4, openai/gpt-5) rather than a fixed dropdown: new models work the day OpenRouter lists them. OpenRouter: List Models returns the live ids. Leaving the model unset uses your account's default model, and openrouter/auto asks OpenRouter to pick.

Streaming off, attribution on

Streaming is pinned off by design: each run of OpenRouter: Chat Completion returns one complete JSON response, the shape canvas workflows and downstream nodes consume, and workflow config cannot re-enable it. Requests carry Mattering attribution headers identifying Mattering Automations as the calling app; these affect only attribution on OpenRouter's public rankings, never routing, pricing, or billing.

Troubleshooting

Test Connection fails with a 401
The key is invalid, was revoked, or picked up stray whitespace when pasted. OpenRouter answers a bad bearer key with a 401 User not found error. Create a fresh key on the Keys page in your OpenRouter settings and update the credential on the connector.
The models list works but chat completions fail with an auth error
A successful OpenRouter: List Models call proves nothing: OpenRouter serves its catalog without authentication, so that node succeeds even when the stored key is broken. Run OpenRouter: Get Current API Key instead; it requires a valid key and is the real credential check. If it fails, fix the credential as for a 401.
Chat completions fail with a payment or credits error
OpenRouter bills prepaid credits per token, and a key with nothing left cannot complete paid calls. Check the balance signal with OpenRouter: Get Current API Key: limit_remaining shows what the key can still spend (null means unlimited), alongside daily, weekly, and monthly usage totals. Top up credits in OpenRouter, or schedule that node as a watchdog so the team hears about low credits before workflows do.
There is no node for credits or account activity
Deliberate. OpenRouter gates its credits and activity endpoints behind a separate management key class, not the ordinary inference key this integration stores, so nodes for them would always fail with the connector's normal credential. Use OpenRouter: Get Current API Key for the balance signal: limit, limit_remaining, and usage totals come back free on the inference key.
A generation lookup returns a 404 right after the completion
The billing record can lag the completion by a moment. OpenRouter: Get Generation reads a record OpenRouter finalizes shortly after the call, so a lookup fired immediately can miss it. Retry briefly; the id from the chat response's data.id is correct.
The response came from a different model than the one configured
The fallback list did its job: the primary model was down or over quota and the request fell through the list in order. The response's data.model reports which id actually served, so log it if the distinction matters. If a substitute model is unacceptable for a workflow, shorten or remove the fallback list so the call fails loudly instead of falling through.
A provider you do not want keeps serving the requests
Set the provider preferences on OpenRouter: Chat Completion: order pins a preferred sequence, only restricts routing to an allowlist, and ignore excludes specific providers. The slugs those lists take come from OpenRouter: List Providers, and OpenRouter: Get Model Endpoints shows which providers serve a given model with their pricing, uptime, and latency, so the restriction can be an informed one.
A workflow needs streaming output
Streaming is pinned off by design and cannot be enabled from node config: the canvas consumes one JSON response per execution, and a token stream has no meaningful shape in a workflow step. Each run of OpenRouter: Chat Completion returns the complete answer when the model finishes. If perceived latency is the concern, cap completion tokens or route to a faster model; OpenRouter: Get Model Endpoints lists throughput and latency percentiles per provider.

OpenRouter is a trademark of its respective owner. Mattering uses platform names to identify the services these integrations connect to; no endorsement or affiliation is implied.

Start Free Explore our Products