Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public partial interface IOpenRouterClient : global::System.IDisposable
/// </summary>
public SubpackageCreditsClient SubpackageCredits { get; }

/// <summary>
///
/// </summary>
public SubpackageDatasetsClient SubpackageDatasets { get; }

/// <summary>
///
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#nullable enable

namespace OpenRouter
{
public partial interface ISubpackageDatasetsClient
{
/// <summary>
/// Daily token totals for top 50 models<br/>
/// Returns the top 50 public models per day by total token usage on OpenRouter, plus a<br/>
/// single aggregated `other` row per day that sums every model outside that top 50.<br/>
/// Token totals are `prompt_tokens + completion_tokens`, matching the public rankings<br/>
/// chart on openrouter.ai/rankings.<br/>
/// Each row is a distinct `(date, model_permaslug)` pair. The `other` row uses the<br/>
/// reserved permaslug `other` and is always returned last within its date, so callers<br/>
/// can compute `top-50 traffic / total daily traffic` without a second request.<br/>
/// Authenticate with any valid OpenRouter API key (same key used for inference).<br/>
/// Rate-limited to 30 requests/minute per key and 500 requests/day per account.<br/>
/// When republishing or quoting this dataset, OpenRouter must be cited as:<br/>
/// "Source: OpenRouter (openrouter.ai/rankings), as of {as_of}."<br/>
/// Token counts come from each upstream provider's own tokenizer (Anthropic counts<br/>
/// are as reported by Anthropic, OpenAI counts are as reported by OpenAI, etc.), so<br/>
/// a token in one row is not directly comparable to a token in another row from a<br/>
/// different provider.
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
global::System.Threading.Tasks.Task<global::OpenRouter.RankingsDailyResponse> GetRankingsDailyAsync(
string? startDate = default,
string? endDate = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Daily token totals for top 50 models<br/>
/// Returns the top 50 public models per day by total token usage on OpenRouter, plus a<br/>
/// single aggregated `other` row per day that sums every model outside that top 50.<br/>
/// Token totals are `prompt_tokens + completion_tokens`, matching the public rankings<br/>
/// chart on openrouter.ai/rankings.<br/>
/// Each row is a distinct `(date, model_permaslug)` pair. The `other` row uses the<br/>
/// reserved permaslug `other` and is always returned last within its date, so callers<br/>
/// can compute `top-50 traffic / total daily traffic` without a second request.<br/>
/// Authenticate with any valid OpenRouter API key (same key used for inference).<br/>
/// Rate-limited to 30 requests/minute per key and 500 requests/day per account.<br/>
/// When republishing or quoting this dataset, OpenRouter must be cited as:<br/>
/// "Source: OpenRouter (openrouter.ai/rankings), as of {as_of}."<br/>
/// Token counts come from each upstream provider's own tokenizer (Anthropic counts<br/>
/// are as reported by Anthropic, OpenAI counts are as reported by OpenAI, etc.), so<br/>
/// a token in one row is not directly comparable to a token in another row from a<br/>
/// different provider.
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
global::System.Threading.Tasks.Task<global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.RankingsDailyResponse>> GetRankingsDailyAsResponseAsync(
string? startDate = default,
string? endDate = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

#nullable enable

namespace OpenRouter
{
/// <summary>
/// If no httpClient is provided, a new one will be created.<br/>
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
public partial interface ISubpackageDatasetsClient : global::System.IDisposable
{
/// <summary>
/// The HttpClient instance.
/// </summary>
public global::System.Net.Http.HttpClient HttpClient { get; }

/// <summary>
/// The base URL for the API.
/// </summary>
public System.Uri? BaseUri { get; }

/// <summary>
/// The authorizations to use for the requests.
/// </summary>
public global::System.Collections.Generic.List<global::OpenRouter.EndPointAuthorization> Authorizations { get; }

/// <summary>
/// Gets or sets a value indicating whether the response content should be read as a string.
/// True by default in debug builds, false otherwise.
/// When false, successful responses are deserialized directly from the response stream for better performance.
/// Error responses are always read as strings regardless of this setting,
/// ensuring <see cref="ApiException.ResponseBody"/> is populated.
/// </summary>
public bool ReadResponseAsString { get; set; }
/// <summary>
/// Client-wide request defaults such as headers, query parameters, retries, and timeout.
/// </summary>
public global::OpenRouter.AutoSDKClientOptions Options { get; }


/// <summary>
///
/// </summary>
global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; }


}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace OpenRouter.JsonConverters
{
/// <inheritdoc />
public sealed class RankingsDailyMetaVersionJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenRouter.RankingsDailyMetaVersion>
{
/// <inheritdoc />
public override global::OpenRouter.RankingsDailyMetaVersion Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::OpenRouter.RankingsDailyMetaVersionExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::OpenRouter.RankingsDailyMetaVersion)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::OpenRouter.RankingsDailyMetaVersion);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenRouter.RankingsDailyMetaVersion value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::OpenRouter.RankingsDailyMetaVersionExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace OpenRouter.JsonConverters
{
/// <inheritdoc />
public sealed class RankingsDailyMetaVersionNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenRouter.RankingsDailyMetaVersion?>
{
/// <inheritdoc />
public override global::OpenRouter.RankingsDailyMetaVersion? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::OpenRouter.RankingsDailyMetaVersionExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::OpenRouter.RankingsDailyMetaVersion)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::OpenRouter.RankingsDailyMetaVersion?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenRouter.RankingsDailyMetaVersion? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::OpenRouter.RankingsDailyMetaVersionExtensions.ToValueString(value.Value));
}
}
}
}
Loading