MCPcopy Create free account
hub / github.com/ccusage/ccusage / infer_provider

Function infer_provider

rust/crates/ccusage/src/adapter/codebuff/parser.rs:367–390  ·  view source on GitHub ↗
(model: &str)

Source from the content-addressed store, hash-verified

365}
366
367fn infer_provider(model: &str) -> &'static str {
368 let model = model.to_ascii_lowercase();
369 if model.starts_with("claude-")
370 || model.starts_with("anthropic/")
371 || model.starts_with("anthropic.")
372 {
373 "anthropic"
374 } else if model.starts_with("gpt-")
375 || model.starts_with("o1")
376 || model.starts_with("o3")
377 || model.starts_with("o4")
378 || model.starts_with("openai/")
379 {
380 "openai"
381 } else if model.starts_with("gemini") || model.starts_with("google/") {
382 "google"
383 } else if model.starts_with("grok") || model.starts_with("xai/") {
384 "xai"
385 } else if model.starts_with("openrouter/") {
386 "openrouter"
387 } else {
388 "unknown"
389 }
390}
391
392pub(super) fn calculate_codebuff_cost(entry: &CodebuffEntry, pricing: &PricingMap) -> f64 {
393 let usage = TokenUsageRaw {

Callers 1

load_chat_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected