Learning resourcesReviewed · OpenRouter

OpenRouter Go SDK Datasets reference

The OpenRouter Go SDK Datasets reference is documentation for developers and analysts retrieving AI usage and spending data, but token counts from different providers are not directly comparable. It explains access to public app rankings, model usage totals and aggregated session costs through three SDK methods.

Researched 25 Nov 2026

In short.

The OpenRouter Go SDK Datasets reference is an API guide for developers and analysts studying AI usage and spending, but token counts from different providers are not directly comparable. It documents public app rankings, model token totals and weekly refreshed session-cost aggregates. Category and language filters use sampled estimates, and the ranking endpoints require an API key and impose request limits. Returned data carries a CC BY 4.0 reuse notice; dataset access pricing is unknown. No code or API requests were executed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete Datasets reference at [https://openrouter.ai/docs/client-sdks/go/sdks/datasets/README.md]: its overview, three operations, Go examples, parameter and response descriptions, error tables, access limits, aggregation notes and data-license notices. The documentation index, linked type definitions, SDK implementation, license text and public ranking pages are excluded. No dataset records were supplied, and no code or API requests were executed.

The overview

Identity

This is the Datasets reference within OpenRouter's Go SDK documentation at [https://openrouter.ai/docs/client-sdks/go/sdks/datasets/README.md]. It documents GetAppRankings, GetRankingsDaily and GetSessionCost, with Go examples, method signatures and error tables.

The page explains how to retrieve public usage datasets. It does not itself supply dataset records, model weights or an evaluation benchmark.

Assessment

The reference supports planning dashboards or analyses of public app activity, model traffic and spending for published harnesses, meaning the applications or systems running model sessions. It provides specific filtering, pagination and interpretation rules.

Its metrics describe recorded usage and spending. They do not establish model quality, user counts or task success. Coverage concerns OpenRouter traffic, and provider differences in token counting limit comparisons.

Users

Go developers can use the examples as a starting point for retrieving these datasets. Analysts can use the methodological notes to distinguish token volume, absolute growth and median session spending.

Beginners will need familiarity with Go imports, environment variables, API credentials and error handling. Experienced developers will still need the linked request and response definitions to establish complete field types and payload structures; those definitions are outside this page.

Capabilities

GetAppRankings returns public apps ranked within a requested date window. It supports popular and trending sorts, category and subcategory filters, and offset pagination. Hidden and private apps are excluded, and related app aliases are merged into their canonical visible app.

GetRankingsDaily returns the top 50 public models by daily token usage, plus an other row containing all models outside that top 50. It supports time-grain and dataset filters, subject to restrictions.

GetSessionCost returns aggregated session-cost cells for published harnesses. Filters include app_slug, model and turn_range. Filtering by model alone supports comparing harnesses at a fixed model.

Using it

Requirements

The examples require a Go environment and the OpenRouter Go SDK. GetAppRankings and GetRankingsDaily explicitly accept any valid OpenRouter API key, including the key used for inference. The GetSessionCost example also configures an API key, although its access requirements are not separately described.

Both ranking methods document limits of 30 requests per minute per key and 500 requests per day per account. Whether their quotas are shared is unspecified. Session-cost-specific limits, the minimum Go version and the required SDK version are unknown.

Mechanism

Ranking token totals add prompt_tokens and completion_tokens. For apps, popular sorts by window volume. Trending subtracts the average volume of the three preceding equal-length periods from the requested window's volume. Apps without excess growth are omitted. Filtering renumbers ranks, while offset pagination preserves those ranks across pages.

For model rankings, period selects day, week or month. Modality and context_bucket filter the exact dataset. Category and language_type instead use sampled data scaled up into weekly-grain estimates. These two filters cannot be combined with each other or with the exact filters, and period=day produces a 400 error.

Session-cost medians represent per-session spending in USD. Sessions are never pooled across apps, and the aggregation exposes neither individual session rows nor clerk_user_id values. Results refresh weekly and include their source snapshot window in meta.

Setup

The examples read OPENROUTER_API_KEY from the environment, configure the client through openrouter.New and openrouter.WithSecurity, create a context, and call a method under s.Datasets. The app-ranking and session-cost examples also import the SDK's models/operations package for request objects.

The app-ranking and session-cost examples advance through responses with res.Next(). The model-ranking example handles a single response. Application code must supply the item processing omitted by the examples.

The error tables identify bad requests, unauthorized requests, throttling, server errors and generic API errors. Installation commands and complete recovery strategies are not provided.

Example

For a dashboard of public coding apps, a documented approach is to request GetAppRankings with category=coding, choose popular for total volume or trending for absolute excess growth, and process successive pages. The interpretation should retain the requested date window and dataset's as_of value.

For a model-usage chart, the daily top-50 rows and other row allow calculation of the top 50's share of the returned daily traffic without a second request. These are proposed uses of the documented operations; no requests were made and no numerical results are available.

Assessment & evidence

Limitations

Public app rankings exclude hidden and private apps. Model category and language views contain sampled estimates rather than the exact totals used by other filters. Session costs cover published harnesses and expose aggregates, preventing inspection of individual sessions.

Providers supply token counts using their own tokenizers. A token in one provider's traffic is therefore not directly comparable to a token from another provider, complicating app and model comparisons.

The GetRankingsDaily example passes nil for its request although the parameter table marks that request as required. Whether nil is accepted was not assessed. Complete response schemas, historical coverage, missing-data behavior and service availability are not established by this page.

Reasoning

Token volume supports an assessment of recorded activity, but it cannot by itself identify the best model or the number of people using an app. Trending measures absolute excess volume, so it should not be interpreted as percentage growth.

Comparing session spending at a fixed model narrows one source of variation, but the page supplies no task outcomes or measures of task difficulty. Lower median spending alone cannot establish better efficiency or equivalent results.

Alternatives

The documentation identifies the public apps marketplace [https://openrouter.ai/apps] and model rankings chart [https://openrouter.ai/rankings] as corresponding views of the ranking data. These are possible starting points for readers who want to view rankings without building a Go integration.

Those pages were not assessed, so their features and access conditions are unknown here. This reference does not establish an alternative SDK, another dataset provider or a substitute for the session-cost endpoint.

Evidence

The evidence consists of the complete OpenRouter Go SDK Datasets reference page. It supports statements about documented operations, examples, restrictions, attribution requirements and aggregation methods.

No returned dataset records, SDK source implementation or independent measurements are included. The code was not executed, and endpoint behavior, data accuracy, performance and availability were not assessed.

Access & freshness

Costs

The page does not state a price for dataset requests or establish that access is free. API-key requirements, request limits and permission to reuse returned data do not resolve the access price.

GetSessionCost reports median session spending in USD; those figures are dataset measurements rather than the price of calling the endpoint. No actual spending values are supplied, so neither session costs nor potential savings can be estimated here.

Rights

The page explicitly licenses data returned by these endpoints under CC BY 4.0 [https://creativecommons.org/licenses/by/4.0/]. Its notice permits reuse and republication, including commercially, with attribution to OpenRouter.

The ranking datasets prescribe credits identifying OpenRouter, the corresponding public page and the dataset's as_of value. App rankings identify [https://openrouter.ai/apps]; model rankings identify [https://openrouter.ai/rankings]. Preserve the exact attribution wording specified in the reference when publishing.

The stated license applies to returned data. The page does not establish a license for redistributing the documentation itself or the SDK source, and the linked license text was not assessed.

Freshness

The documentation was captured on 25 November 2026. It supplies no publication date, last-updated date or SDK version, so the capture date does not establish when its behavior last changed.

Session-cost data refreshes weekly and reports its snapshot window in meta. Ranking attribution uses as_of. Those dataset timestamps, rather than the documentation capture date, should accompany interpretations of retrieved results.

Actions

Before building an integration, confirm dataset-request pricing, compatible Go and SDK versions, complete request and response types, and session-cost access limits. Resolve the GetRankingsDaily nil-request discrepancy against the intended SDK version.

Choose exact or sampled ranking views deliberately, retain the date window and freshness metadata, and implement pagination and documented error handling. Include the required OpenRouter attribution when publishing data, and assess task outcomes separately before using session-cost medians to choose a harness.

Evidence for this report

selected-page.txtselected · checked 2026-11-25