| Crates.io | model-gateway-rs |
| lib.rs | model-gateway-rs |
| version | 0.1.6 |
| created_at | 2025-06-28 10:42:40.767153+00 |
| updated_at | 2025-08-12 06:22:44.907899+00 |
| description | A Rust library for model gateway services, providing traits and SDKs for various AI models. |
| homepage | https://github.com/code-serenade/model-gateway-rs |
| repository | https://github.com/code-serenade/model-gateway-rs |
| max_upload_size | |
| id | 1729722 |
| size | 87,835 |
model-gateway-rs is a Rust library designed as a unified gateway for interacting with various machine learning model backends. It provides a clean abstraction over different model clients (e.g., OpenAI, LLaMA, Gemini) so you can integrate multiple models through a single consistent interface.
async-traitsrc/
├── clients/ # Concrete client implementations (e.g., OpenAI)
├── sdk/ # High-level SDK for external usage
├── traits/ # Core model traits (text, embed, vision)
├── types/ # Shared types (input/output data structures)
└── lib.rs # Library entry point
Add to your Cargo.toml:
model-gateway = { git = "https://github.com/code-serenade/model-gateway-rs" }
Example:
use model_gateway::traits::text::TextGeneration;
async fn run_inference(client: impl TextGeneration) {
let prompt = TextPrompt {
prompt: "Hello, world!".to_string(),
system_prompt: None,
temperature: None,
top_p: None,
};
let result = client.infer_text(prompt).await.unwrap();
println!("Result: {}", result.content);
}
MIT