-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Surface ModelBilling.tokenPrices on public SDK types #1633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MackinnonBuck
wants to merge
2
commits into
main
Choose a base branch
from
mackinnonbuck/expose-modelbilling-tokenprices
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3308,6 +3308,70 @@ public sealed class ModelBilling | |
| /// </summary> | ||
| [JsonPropertyName("multiplier")] | ||
| public double? Multiplier { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Token-level pricing information for this model. | ||
| /// </summary> | ||
| [JsonPropertyName("tokenPrices")] | ||
| public ModelBillingTokenPrices? TokenPrices { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Token-level pricing information for a model | ||
| /// </summary> | ||
| public sealed class ModelBillingTokenPrices | ||
| { | ||
| /// <summary>AI Credits cost per billing batch of input tokens.</summary> | ||
| [JsonPropertyName("inputPrice")] | ||
| public double? InputPrice { get; set; } | ||
|
|
||
| /// <summary>AI Credits cost per billing batch of output tokens.</summary> | ||
| [JsonPropertyName("outputPrice")] | ||
| public double? OutputPrice { get; set; } | ||
|
|
||
| /// <summary>AI Credits cost per billing batch of cached tokens.</summary> | ||
| [JsonPropertyName("cachePrice")] | ||
| public double? CachePrice { get; set; } | ||
|
|
||
| /// <summary>Number of tokens per standard billing batch.</summary> | ||
| [JsonPropertyName("batchSize")] | ||
| public int? BatchSize { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Prompt token budget (max_prompt_tokens) for the default tier. The total | ||
| /// context window is this value plus the model's max_output_tokens. | ||
| /// </summary> | ||
| [JsonPropertyName("contextMax")] | ||
| public int? ContextMax { get; set; } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the same naming we use elsewhere for this concept? I'd have expected MaxContextWindow or something like that. |
||
|
|
||
| /// <summary>Long context tier pricing (available for models with extended context windows).</summary> | ||
| [JsonPropertyName("longContext")] | ||
| public ModelBillingTokenPricesLongContext? LongContext { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Long context tier pricing (available for models with extended context windows) | ||
| /// </summary> | ||
| public sealed class ModelBillingTokenPricesLongContext | ||
| { | ||
| /// <summary>AI Credits cost per billing batch of input tokens.</summary> | ||
| [JsonPropertyName("inputPrice")] | ||
| public double? InputPrice { get; set; } | ||
|
|
||
| /// <summary>AI Credits cost per billing batch of output tokens.</summary> | ||
| [JsonPropertyName("outputPrice")] | ||
| public double? OutputPrice { get; set; } | ||
|
|
||
| /// <summary>AI Credits cost per billing batch of cached tokens.</summary> | ||
| [JsonPropertyName("cachePrice")] | ||
| public double? CachePrice { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Prompt token budget (max_prompt_tokens) for the long context tier. The total | ||
| /// context window is this value plus the model's max_output_tokens. | ||
| /// </summary> | ||
| [JsonPropertyName("contextMax")] | ||
| public int? ContextMax { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -3509,6 +3573,8 @@ public sealed class SystemMessageTransformRpcResponse | |
| [JsonSerializable(typeof(McpServerConfig))] | ||
| [JsonSerializable(typeof(MessageOptions))] | ||
| [JsonSerializable(typeof(ModelBilling))] | ||
| [JsonSerializable(typeof(ModelBillingTokenPrices))] | ||
| [JsonSerializable(typeof(ModelBillingTokenPricesLongContext))] | ||
| [JsonSerializable(typeof(ModelCapabilities))] | ||
| [JsonSerializable(typeof(ModelCapabilitiesOverride))] | ||
| [JsonSerializable(typeof(ModelInfo))] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
java/src/main/java/com/github/copilot/rpc/ModelBillingTokenPrices.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| package com.github.copilot.rpc; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * Token-level pricing information for a model. | ||
| * | ||
| * @since 1.0.2 | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class ModelBillingTokenPrices { | ||
|
|
||
| /** | ||
| * AI Credits cost per billing batch of input tokens. | ||
| */ | ||
| @JsonProperty("inputPrice") | ||
| private Double inputPrice; | ||
|
|
||
| /** | ||
| * AI Credits cost per billing batch of output tokens. | ||
| */ | ||
| @JsonProperty("outputPrice") | ||
| private Double outputPrice; | ||
|
|
||
| /** | ||
| * AI Credits cost per billing batch of cached tokens. | ||
| */ | ||
| @JsonProperty("cachePrice") | ||
| private Double cachePrice; | ||
|
|
||
| /** | ||
| * Number of tokens per standard billing batch. | ||
| */ | ||
| @JsonProperty("batchSize") | ||
| private Integer batchSize; | ||
|
|
||
| /** | ||
| * Prompt token budget (max_prompt_tokens) for the default tier. The total | ||
| * context window is this value plus the model's max_output_tokens. | ||
| */ | ||
| @JsonProperty("contextMax") | ||
| private Integer contextMax; | ||
|
|
||
| /** | ||
| * Long context tier pricing (available for models with extended context | ||
| * windows). | ||
| */ | ||
| @JsonProperty("longContext") | ||
| private ModelBillingTokenPricesLongContext longContext; | ||
|
|
||
| public Double getInputPrice() { | ||
| return inputPrice; | ||
| } | ||
|
|
||
| public ModelBillingTokenPrices setInputPrice(Double inputPrice) { | ||
| this.inputPrice = inputPrice; | ||
| return this; | ||
| } | ||
|
|
||
| public Double getOutputPrice() { | ||
| return outputPrice; | ||
| } | ||
|
|
||
| public ModelBillingTokenPrices setOutputPrice(Double outputPrice) { | ||
| this.outputPrice = outputPrice; | ||
| return this; | ||
| } | ||
|
|
||
| public Double getCachePrice() { | ||
| return cachePrice; | ||
| } | ||
|
|
||
| public ModelBillingTokenPrices setCachePrice(Double cachePrice) { | ||
| this.cachePrice = cachePrice; | ||
| return this; | ||
| } | ||
|
|
||
| public Integer getBatchSize() { | ||
| return batchSize; | ||
| } | ||
|
|
||
| public ModelBillingTokenPrices setBatchSize(Integer batchSize) { | ||
| this.batchSize = batchSize; | ||
| return this; | ||
| } | ||
|
|
||
| public Integer getContextMax() { | ||
| return contextMax; | ||
| } | ||
|
|
||
| public ModelBillingTokenPrices setContextMax(Integer contextMax) { | ||
| this.contextMax = contextMax; | ||
| return this; | ||
| } | ||
|
|
||
| public ModelBillingTokenPricesLongContext getLongContext() { | ||
| return longContext; | ||
| } | ||
|
|
||
| public ModelBillingTokenPrices setLongContext(ModelBillingTokenPricesLongContext longContext) { | ||
| this.longContext = longContext; | ||
| return this; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need new types for this, or could / should we just return the Rpc type?
In general, I'm wondering about these "higher-level" APIs that are effectively identical to the RPC ones.