Expand description
§gh_models
A Rust client for the GitHub Models API. This crate provides a simple interface for sending chat completion requests to GitHub-hosted AI models, similar to OpenAI’s Python client.
§Example
use gh_models::{GHModels, types::ChatMessage};
use std::env;
#[tokio::main]
async fn main() {
    let token = env::var("GITHUB_TOKEN").expect("Missing GITHUB_TOKEN");
    let client = GHModels::new(token);
    let messages = vec![
        ChatMessage { role: "system".into(), content: "You are a helpful assistant.".into() },
        ChatMessage { role: "user".into(), content: "What is the capital of France?".into() },
    ];
    let response = client.chat_completion("openai/gpt-4o", messages, 1.0, 4096, 1.0).await.unwrap();
    println!("{}", response.choices[0].message.content);
}Re-exports§
- pub use client::*;