mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-07 03:00:29 +00:00
The OpenAPI spec adopts the lithos request, response, content part, tool, usage, and cost schemas. The completions endpoint returns the lithos `Response` JSON verbatim and SSE carries lithos `StreamEvent`s verbatim. The models and providers endpoints serve the fabro-types catalog views, and the install and model-test flows probe providers through fabro-llm. The CLI builds its catalog from the operator overlay, drives `fabro exec` through the server gateway adapter, and parses reasoning effort with the shared controls. The web app reads content parts as lithos-tagged objects. The TypeScript client is regenerated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
36 lines
999 B
Rust
36 lines
999 B
Rust
use std::any::{TypeId, type_name};
|
|
|
|
use fabro_api::types::ModelCosts as ApiModelCosts;
|
|
use fabro_types::ModelCosts;
|
|
|
|
#[test]
|
|
fn model_costs_reuses_canonical_type() {
|
|
assert_same_type::<ApiModelCosts, ModelCosts>();
|
|
}
|
|
|
|
#[test]
|
|
fn model_costs_json_matches_openapi_shape() {
|
|
let costs = ModelCosts {
|
|
input_cost_per_mtok: Some(5.0),
|
|
output_cost_per_mtok: Some(25.0),
|
|
cache_input_cost_per_mtok: Some(0.5),
|
|
};
|
|
|
|
let json = serde_json::to_value(costs).unwrap();
|
|
assert_eq!(json["input_cost_per_mtok"], 5.0);
|
|
assert_eq!(json["output_cost_per_mtok"], 25.0);
|
|
assert_eq!(json["cache_input_cost_per_mtok"], 0.5);
|
|
|
|
let round_trip: ApiModelCosts = serde_json::from_value(json).unwrap();
|
|
assert_eq!(round_trip, costs);
|
|
}
|
|
|
|
fn assert_same_type<T: 'static, U: 'static>() {
|
|
assert_eq!(
|
|
TypeId::of::<T>(),
|
|
TypeId::of::<U>(),
|
|
"{} should be the same type as {}",
|
|
type_name::<T>(),
|
|
type_name::<U>()
|
|
);
|
|
}
|