-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Capture telemetry data on per-user monthly LLM spending (#16050)
Release Notes: - N/A --------- Co-authored-by: Marshall <marshall@zed.dev>
- Loading branch information
1 parent
8688b2a
commit 33e120d
Showing
10 changed files
with
153 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
3 changes: 3 additions & 0 deletions
3
crates/collab/migrations_llm/20240809160000_add_pricing_columns_to_models.sql
This file contains 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,3 @@ | ||
ALTER TABLE models | ||
ADD COLUMN price_per_million_input_tokens integer NOT NULL DEFAULT 0, | ||
ADD COLUMN price_per_million_output_tokens integer NOT NULL DEFAULT 0; |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,45 +1,45 @@ | ||
use super::*; | ||
use crate::{Config, Result}; | ||
use queries::providers::ModelRateLimits; | ||
use queries::providers::ModelParams; | ||
|
||
pub async fn seed_database(_config: &Config, db: &mut LlmDatabase, _force: bool) -> Result<()> { | ||
db.insert_models(&[ | ||
( | ||
LanguageModelProvider::Anthropic, | ||
"claude-3-5-sonnet".into(), | ||
ModelRateLimits { | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 20_000, | ||
max_tokens_per_day: 300_000, | ||
}, | ||
), | ||
( | ||
LanguageModelProvider::Anthropic, | ||
"claude-3-opus".into(), | ||
ModelRateLimits { | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 10_000, | ||
max_tokens_per_day: 300_000, | ||
}, | ||
), | ||
( | ||
LanguageModelProvider::Anthropic, | ||
"claude-3-sonnet".into(), | ||
ModelRateLimits { | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 20_000, | ||
max_tokens_per_day: 300_000, | ||
}, | ||
), | ||
( | ||
LanguageModelProvider::Anthropic, | ||
"claude-3-haiku".into(), | ||
ModelRateLimits { | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 25_000, | ||
max_tokens_per_day: 300_000, | ||
}, | ||
), | ||
ModelParams { | ||
provider: LanguageModelProvider::Anthropic, | ||
name: "claude-3-5-sonnet".into(), | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 20_000, | ||
max_tokens_per_day: 300_000, | ||
price_per_million_input_tokens: 300, // $3.00/MTok | ||
price_per_million_output_tokens: 1500, // $15.00/MTok | ||
}, | ||
ModelParams { | ||
provider: LanguageModelProvider::Anthropic, | ||
name: "claude-3-opus".into(), | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 10_000, | ||
max_tokens_per_day: 300_000, | ||
price_per_million_input_tokens: 1500, // $15.00/MTok | ||
price_per_million_output_tokens: 7500, // $75.00/MTok | ||
}, | ||
ModelParams { | ||
provider: LanguageModelProvider::Anthropic, | ||
name: "claude-3-sonnet".into(), | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 20_000, | ||
max_tokens_per_day: 300_000, | ||
price_per_million_input_tokens: 1500, // $15.00/MTok | ||
price_per_million_output_tokens: 7500, // $75.00/MTok | ||
}, | ||
ModelParams { | ||
provider: LanguageModelProvider::Anthropic, | ||
name: "claude-3-haiku".into(), | ||
max_requests_per_minute: 5, | ||
max_tokens_per_minute: 25_000, | ||
max_tokens_per_day: 300_000, | ||
price_per_million_input_tokens: 25, // $0.25/MTok | ||
price_per_million_output_tokens: 125, // $1.25/MTok | ||
}, | ||
]) | ||
.await | ||
} |
This file contains 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 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
Oops, something went wrong.