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
33 changes: 33 additions & 0 deletions crates/switchyard-desktop/src/history.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//! This module describes one completed model call in the routing log.

use serde::Deserialize;

#[derive(Debug, Deserialize, serde::Serialize)]
pub struct Entry {
pub ts: String,
pub model: String,
#[serde(default)]
pub session_id: Option<String>,
#[serde(default)]
pub turn_id: Option<String>,
#[serde(default)]
pub route_id: String,
#[serde(default)]
pub tier: String,
#[serde(default)]
pub prompt_tokens: u64,
#[serde(default)]
pub cached_tokens: u64,
#[serde(default)]
pub cache_creation_tokens: u64,
#[serde(default)]
pub cache_creation_1h_tokens: u64,
#[serde(default)]
pub completion_tokens: u64,
/// The server records the charge or estimate when it has rates; older records have none.
#[serde(default)]
pub cost: Option<switchyard_costs::RecordedCost>,
}
2 changes: 2 additions & 0 deletions crates/switchyard-desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

pub mod config;
pub mod health;
pub mod history;
pub mod install;
pub mod rollup;
Loading
Loading