openrouter-provider
Type definitions for the OpenRouter Provider API. The types are kept 1:1 with the spec for the List Models Endpoint which is required to be implemented by any model provider who wants to sell inference on OpenRouter.
[dependencies]
openrouter-provider = "0.1"
Usage example:
use openrouter_provider::{
ListModelsResponse, Model, Pricing, InputModality, OutputModality, Quantization
};
let response = ListModelsResponse {
data: vec![Model {
id: "my-org/my-model".to_string(),
name: "My Model".to_string(),
created: 1700000000,
input_modalities: vec![InputModality::Text],
output_modalities: vec![OutputModality::Text],
quantization: Quantization::Fp16,
context_length: 128000,
max_output_length: 4096,
pricing: Pricing::new("0.000001", "0.000002"),
supported_sampling_parameters: vec![],
supported_features: vec![],
openrouter: None,
hugging_face_id: None,
description: None,
datacenters: None,
}],
};
let json = serde_json::to_string(&response).unwrap();