October 2026 release is live Read More

Connect OpenRouter agents

See the cost and usage of each agent that calls models through OpenRouter. OpenRouter sends a trace of every request to Mavvrik, so the only change to your code is adding the agent name to each request.

Before you start

  • Admin access to your OpenRouter organization.

  • You can create an agent connection in Mavvrik.

  • Access to the code that calls OpenRouter.

Step 1. Register the connection in Mavvrik

  1. In Mavvrik, go to Agents and select + Agent.

  2. Under Others, select OpenTelemetry.

mvk-1-picker.png
  1. Enter a Connection Name, for example openrouter-prod, and select Next.

mvk-2-setup.png

Step 2. Copy the endpoint and headers

  1. Copy the Endpoint.

mvk-3-endpoint.png
  1. Copy the Headers. The Authorization value is a secret key; store it securely.

mvk-4-headers.png
  1. Set Agent ID attribute to trace.metadata.agent_id and Agent name attribute to trace.metadata.agent_name.

mvk-5-identity.png
  1. Select Register.

Step 3. Add Mavvrik as a Broadcast destination in OpenRouter

  1. In OpenRouter, open Settings → Observability and turn on Broadcast.

or-1-observability.png
  1. Find OpenTelemetry Collector and select Add Destination.

or-2-otel-row.png
  1. Fill in the form:

    • Name: Mavvrik

    • Endpoint: the endpoint from Step 2 followed by /v1/traces

    • Headers: the headers from Step 2, pasted as they are

  2. Select Test Connection, then Add.

or-3-form.png

Step 4. Add the agent to each request

Add a trace object with agent_id and agent_name to every OpenRouter request:

JSON
"trace": { "agent_id": "support-bot", "agent_name": "Support Bot" }

Keep agent_id the same for an agent; a new value creates a new agent in Mavvrik. To see sessions and users too, see Sessions and users.

Step 5. Check your data

  1. Run your agents through OpenRouter.

  2. In Mavvrik, go to Agents → Others, open the connection and confirm your agents are listed by name.

  3. Open Agent Cost, select the Reported view, and compare the total with OpenRouter for the same period.

Data usually appears within an hour, and always within 24 hours. Something missing? See Troubleshooting.

Learn more