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 @@ -40,7 +40,7 @@ internal static partial class GetRoutesUsageCommandApiCommand
private static Option<global::System.Collections.Generic.IList<global::Baseten.RouteUsageDimensionV1>?> GroupBy { get; } = new(
name: @"--group-by")
{
Description = @"Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, or PROVIDER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. Defaults to MODEL.",
Description = @"Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, PROVIDER, or ROUTER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. ROUTER returns only usage sent through an intelligent router, one row per router, or per router and model with MODEL. Router rows repeat usage already counted in other groupings, so don't add them to model totals. Defaults to MODEL.",
};

private static Option<global::System.Collections.Generic.IList<string>?> UserIds { get; } = new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public enum RouteUsageDimensionV1
/// <summary>
///
/// </summary>
Router,
/// <summary>
///
/// </summary>
Team,
/// <summary>
///
Expand All @@ -40,6 +44,7 @@ public static string ToValueString(this RouteUsageDimensionV1 value)
{
RouteUsageDimensionV1.Model => "MODEL",
RouteUsageDimensionV1.Provider => "PROVIDER",
RouteUsageDimensionV1.Router => "ROUTER",
RouteUsageDimensionV1.Team => "TEAM",
RouteUsageDimensionV1.User => "USER",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
Expand All @@ -54,6 +59,7 @@ public static string ToValueString(this RouteUsageDimensionV1 value)
{
"MODEL" => RouteUsageDimensionV1.Model,
"PROVIDER" => RouteUsageDimensionV1.Provider,
"ROUTER" => RouteUsageDimensionV1.Router,
"TEAM" => RouteUsageDimensionV1.Team,
"USER" => RouteUsageDimensionV1.User,
_ => null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public sealed partial class RoutesUsageRequestV1
public global::System.DateTime? EndDate { get; set; }

/// <summary>
/// Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, or PROVIDER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. Defaults to MODEL.
/// Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, PROVIDER, or ROUTER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. ROUTER returns only usage sent through an intelligent router, one row per router, or per router and model with MODEL. Router rows repeat usage already counted in other groupings, so don't add them to model totals. Defaults to MODEL.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("group_by")]
public global::System.Collections.Generic.IList<global::Baseten.RouteUsageDimensionV1>? GroupBy { get; set; }
Expand Down Expand Up @@ -97,7 +97,7 @@ public sealed partial class RoutesUsageRequestV1
/// Default Value: openapi-json-null-sentinel-value-2BF93600-0FE4-4250-987A-E5DDB203E464
/// </param>
/// <param name="groupBy">
/// Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, or PROVIDER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. Defaults to MODEL.
/// Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, PROVIDER, or ROUTER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. ROUTER returns only usage sent through an intelligent router, one row per router, or per router and model with MODEL. Router rows repeat usage already counted in other groupings, so don't add them to model totals. Defaults to MODEL.
/// </param>
/// <param name="userIds">
/// Return only usage from Routes keys created by these user IDs, repeated once per ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ public sealed partial class RoutesUsageResultV1
[global::System.Text.Json.Serialization.JsonPropertyName("provider")]
public global::Baseten.RouteProviderV1? Provider { get; set; }

/// <summary>
/// Slug of the intelligent router, matching its name in `GET /v1/routes`. Null when not grouping by ROUTER.<br/>
/// Default Value: openapi-json-null-sentinel-value-2BF93600-0FE4-4250-987A-E5DDB203E464
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("router_id")]
public string? RouterId { get; set; }

/// <summary>
/// Estimated cost in USD, returned as an exact decimal string. Costs for OpenAI, Anthropic, and xAI estimate what you pay those providers; they are not Baseten charges.
/// </summary>
Expand Down Expand Up @@ -71,6 +78,13 @@ public sealed partial class RoutesUsageResultV1
[global::System.Text.Json.Serialization.JsonRequired]
public required int OutputTokens { get; set; }

/// <summary>
/// Number of requests; with ROUTER, the requests sent through that router. Usage recorded before requests were counted adds zero.
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("requests")]
[global::System.Text.Json.Serialization.JsonRequired]
public required int Requests { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand All @@ -95,6 +109,9 @@ public sealed partial class RoutesUsageResultV1
/// <param name="outputTokens">
/// Output tokens.
/// </param>
/// <param name="requests">
/// Number of requests; with ROUTER, the requests sent through that router. Usage recorded before requests were counted adds zero.
/// </param>
/// <param name="userId">
/// ID of the user who created the Routes key. Null when not grouping by USER.<br/>
/// Default Value: openapi-json-null-sentinel-value-2BF93600-0FE4-4250-987A-E5DDB203E464
Expand All @@ -111,6 +128,10 @@ public sealed partial class RoutesUsageResultV1
/// Provider that served the requests. Null when not grouping by PROVIDER.<br/>
/// Default Value: openapi-json-null-sentinel-value-2BF93600-0FE4-4250-987A-E5DDB203E464
/// </param>
/// <param name="routerId">
/// Slug of the intelligent router, matching its name in `GET /v1/routes`. Null when not grouping by ROUTER.<br/>
/// Default Value: openapi-json-null-sentinel-value-2BF93600-0FE4-4250-987A-E5DDB203E464
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
Expand All @@ -120,20 +141,24 @@ public RoutesUsageResultV1(
int cachedInputTokens,
int uncachedInputTokens,
int outputTokens,
int requests,
string? userId,
string? teamId,
string? model,
global::Baseten.RouteProviderV1? provider)
global::Baseten.RouteProviderV1? provider,
string? routerId)
{
this.UserId = userId;
this.TeamId = teamId;
this.Model = model;
this.Provider = provider;
this.RouterId = routerId;
this.CostUsd = costUsd ?? throw new global::System.ArgumentNullException(nameof(costUsd));
this.InputTokens = inputTokens;
this.CachedInputTokens = cachedInputTokens;
this.UncachedInputTokens = uncachedInputTokens;
this.OutputTokens = outputTokens;
this.Requests = requests;
}

/// <summary>
Expand Down
28 changes: 24 additions & 4 deletions src/libs/Baseten/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10248,7 +10248,7 @@
"name": "group_by",
"in": "query",
"required": false,
"description": "Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, or PROVIDER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. Defaults to MODEL.",
"description": "Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, PROVIDER, or ROUTER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. ROUTER returns only usage sent through an intelligent router, one row per router, or per router and model with MODEL. Router rows repeat usage already counted in other groupings, so don't add them to model totals. Defaults to MODEL.",
"schema": {
"items": {
"$ref": "#/components/schemas/RouteUsageDimensionV1"
Expand Down Expand Up @@ -33956,6 +33956,19 @@
"default": null,
"description": "Provider that served the requests. Null when not grouping by PROVIDER."
},
"router_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Slug of the intelligent router, matching its name in `GET /v1/routes`. Null when not grouping by ROUTER.",
"title": "Router Id"
},
"cost_usd": {
"description": "Estimated cost in USD, returned as an exact decimal string. Costs for OpenAI, Anthropic, and xAI estimate what you pay those providers; they are not Baseten charges.",
"examples": [
Expand Down Expand Up @@ -33983,14 +33996,20 @@
"description": "Output tokens.",
"title": "Output Tokens",
"type": "integer"
},
"requests": {
"description": "Number of requests; with ROUTER, the requests sent through that router. Usage recorded before requests were counted adds zero.",
"title": "Requests",
"type": "integer"
}
},
"required": [
"cost_usd",
"input_tokens",
"cached_input_tokens",
"uncached_input_tokens",
"output_tokens"
"output_tokens",
"requests"
],
"title": "RoutesUsageResultV1",
"type": "object"
Expand Down Expand Up @@ -34022,7 +34041,8 @@
"USER",
"TEAM",
"MODEL",
"PROVIDER"
"PROVIDER",
"ROUTER"
],
"title": "RouteUsageDimensionV1",
"type": "string"
Expand Down Expand Up @@ -34092,7 +34112,7 @@
"title": "End Date"
},
"group_by": {
"description": "Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, or PROVIDER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. Defaults to MODEL.",
"description": "Dimensions to break usage down by, repeated once per dimension: USER, TEAM, MODEL, PROVIDER, or ROUTER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. ROUTER returns only usage sent through an intelligent router, one row per router, or per router and model with MODEL. Router rows repeat usage already counted in other groupings, so don't add them to model totals. Defaults to MODEL.",
"items": {
"$ref": "#/components/schemas/RouteUsageDimensionV1"
},
Expand Down
Loading