跳到正文
openrouter blog·· 2026-08-17精選AI 評分73

OpenRouter 推出使用分析儀錶板與 Analytics API

Understand your AI usage: every agent, model, and request

AI 導讀

OpenRouter 推出全新使用分析儀錶板與 Analytics API,讓企業能即時追蹤每個智慧體、模型與請求的成本與效能。

  • 核心功能:儀錶板呈現五大指標(總支出、請求數、Token 數量、快取命中率、每百萬 Token 混合成本)並可自訂圖表與檢視。
推薦理由

OpenRouter推出的使用分析儀表盤與 API 讓企業能精準追蹤每個智慧體與模型的成本,便於最佳化資源與預算。

正文 · AI 翻譯

在過去兩年部署代理的每家公司現在都在問同樣的問題:它們為我們帶來了什麼成本,哪些值得?OpenRouter 的 活動儀錶板 和 分析 API 可以按代理、模型、請求回應此問題。

開啟 活動 以檢視支出如何在代理、應用程式和團隊成員之間分配。找出哪些模型和任務推動成本,以及快取在哪裡減少費用。建立並儲存自訂檢視,然後從任何圖表深入到個別請求。

所有資料均可透過 Analytics API 取得。將您的代理指向 openrouter-analytics skill 以深入瞭解使用情況,在終端機中快速獲得答案,或將數字拉入您自己的儀錶板。

先從大局開始

概覽 讓您一目瞭然使用情況。頂部列出五項指標:總支出、請求數、令牌量、快取命中率,以及每百萬令牌的混合成本,每項都有小型圖表並與上一時期比較。在同一畫面中,顯示頂級使用者與應用程式、按模型分配的支出、OpenRouter 代幣與 BYOK 支出、按模型的請求量、提示與完成令牌拆分,以及提示快取。

Activity Overview showing total spend, requests, token volume, cache hit rate, and blended cost per million tokens, with top users, top apps, and a stacked bar chart of daily usage by model

Four Activity Overview charts: BYOK versus OpenRouter spend over time, request volume by model, prompt, completion, and reasoning token breakdown, and cached versus uncached prompt tokens

趨勢 以相同資料按變動排序,而非大小,並提供一個面板顯示上升與下降。檢視模型、使用者、API 金鑰與應用程式的趨勢。利用它來偵測失控的代理、正在獲得採用的新模型,或工具在組織中擴散。

Activity Trends showing spend over time by model and by user, with side panels ranking which models and users are rising or falling

Activity Trends showing spend over time by API key and by app, with side panels ranking which keys and apps are rising or falling

探索任何問題

概覽與趨勢中的每張卡片都連結到 探索,您可以自行組合檢視:

  • 指標:支出、請求數、令牌(提示、完成、推理或快取)、快取命中率、每百萬令牌的混合成本、BYOK 與信用支出對比,或延遲與吞吐量至 P50/P90/P99
  • 分組依據(最多兩個維度):模型、變體、供應商、API 金鑰、應用程式、使用者、工作區、來源、國家、資料區域、結束原因、上下文長度、會話、生成、自訂使用者 ID,或任何您已定義的 分類器 維度
  • 彙總:分鐘、時鐘、日、週或月,或移除時間軸以顯示排名表
  • 圖表型別:條形、折線或點圖

使用它檢視各工作區中推動使用的應用程式、代理為每種任務型別使用的模型,或供應商延遲的時間趨勢。

Activity Explore showing total usage grouped by workspace and app, as a stacked bar with a ranked table of workspace and app pairs

Activity Explore showing request count grouped by task family and model for a single workspace, with a ranked table of task and model pairs

Activity Explore showing average latency by provider as weekly line charts across ten providers

儲存您常用的檢視。開啟選項選單,選擇 儲存目前圖表,並命名。若在組織中,您還可選擇誰能看到:僅我,或 組織內所有人。

The Activity Explore options menu open over a chart, showing Show Other, Cumulative sum, chart type buttons, Download CSV, Download PDF, Save current chart, and Saved charts

下載 CSV 或 下載 PDF,將任何圖表的資料直接匯入試算表或報告。

Guardrails 顯示您的提示注入與敏感資訊規則所阻擋、刪減或標記的專案,以及哪些規則在執行工作。使用它監控敏感資料進入提示的比率,以及哪些規則和資料型別在捕捉。按工作區或分類器篩選,以縮小來源。

Activity Guardrails showing two cards: blocked requests rejected before reaching the model, and redacted or flagged content broken down by sensitive info and prompt injection

展開卡片以檢視完整細分,包括哪些檢測模式組合驅動每個阻擋、刪減與標記。

Expanded Redacted and Flagged card listing sensitive-information redactions by detected entity type, such as phone, person, location, IP address, and email

點選圖表,進入日誌

匯總顯示某些專案成本上升。下一個問題是哪些請求。

Every chart and ranked table in Activity links through to the logs behind it. Click Tuesday’s bar, one model’s slice of a stacked chart, or a row in a ranked table, and you land in your logs filtered to those requests.

A stacked Usage by model chart in Activity with one day's bar selected, showing a popover offering View logs and Open in Explorer

Open any row in logs for the Generation detail view. It shows:

  • Cost:上游推論、快取、網路搜尋與檔案處理,以及套用的折扣和快取節省
  • Performance:供應商延遲、吞吐量與首次 token 時間
  • Routing:請求由哪個供應商處理、是否回退至其他供應商,以及結束原因
  • Attribution:背後的應用程式、API 金鑰與工作區,以及會話與請求 ID 和資料區域
  • Context:任何防護事件、分類器標籤與原始元資料

Generation details panel open beside the logs list, showing provider latency, throughput, cost, token counts, model and canonical IDs, data policy, and the app, API key, request, session, and generation identifiers

Generation details panel showing a provider response waterfall for routing, provider call, and generation, with usage, classifications, prompt, completion, and raw JSON sections

Prompt 詳細檢視會呈現完整訊息陣列以及按角色(系統、使用者、協助者與工具)著色的估計 token 數量火焰圖。成本為預期三倍的對話通常會顯示為寬幅工具呼叫或大量系統提示。快取字首會以陰影顯示,讓您看到快取保留到提示的哪個位置以及哪則訊息中斷了它。

Prompt detail view for a 48-message generation, with a tokens-per-message flamegraph colored by role, cached and prompt token totals with cost, a per-role breakdown, a role filter over the message list, and the selected message's raw content

每則訊息的 token 數量為根據訊息大小估算;生成的總數則為實際使用量。只有在請求執行時啟用了私人輸入/輸出日誌,提示與完成細節才會存在,您可以在工作區的可觀測性設定中啟用此功能。

與 Explore 相同的資料,透過 API 提供

Explore 中的所有內容亦可透過 Analytics API 取得:讓您的代理執行分析、在終端機快速取得答案,或將數值拉入您自己的儀錶板。Analytics 查詢需要 management key。共有兩個端點:

  • GET /api/v1/analytics/meta 會回傳目前支援的指標、維度、篩選運運算元與粒度。先呼叫 metadata 端點以檢視可用專案;我們持續新增指標與維度。
  • POST /api/v1/analytics/query 執行查詢並回傳與 Explore 圖表相同的聚合結果。
curl -X POST https://openrouter.ai/api/v1/analytics/query \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "metrics": ["total_usage", "tokens_total", "cache_hit_rate"],
    "dimensions": ["model"],
    "granularity": "day",
    "time_range": {"start": "2026-07-01T00:00:00Z", "end": "2026-08-01T00:00:00Z"},
    "limit": 20
  }'

針對代理

The cost control cookbook 讓您的代理負責費用分析。給您的程式編寫代理一個管理金鑰與 openrouter-analytics skill,並讓它對您的 OpenRouter 帳戶執行費用審查。它會找出每百萬 token 成本為您混合費率倍數的模型,追蹤其負責的金鑰與管線,並回傳排名建議。

我們在內部執行此流程,發現一個預覽模型每月耗費約 $6.2K,約為組織混合費率的 25 倍。再進行一次深入查詢後,98% 的使用量可追溯至單一批次管線金鑰執行的任務,該任務根本不需要前沿模型。解決方案是單行模型交換。請參閱我們在 cookbook 中使用的查詢配方與代理提示。

開始使用

Open Activity,或若您已知想要得到的答案,直接從 Explore 開始。若想在終端機操作,請取得 management key 並呼叫 Analytics API。

請在 Discord 的 #feedback 頻道告訴我們您接下來想看到什麼。

來源:openrouter blog · openrouter.ai