GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - edgee-ai/rust-sdk: The official Rust library for the Edgee AI Gateway

BranchesTags
Open more actions menu

Latest commit

 

History

512 Commits
512 Commits

Folders and files

NameName
Last commit message
Last commit date
.cargo
.cargo
 
 
.github
.github
 
 
examples
examples
 
 
src
src
 
 
.gitignore
.gitignore
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Edgee Rust SDK

Modern, type-safe Rust SDK for the Edgee AI Gateway.

Crates.io License Rust

Installation

Add this to your Cargo.toml:

[dependencies]
edgee = "2.0"
tokio = { version = "1", features = ["full"] }

Quick Start

use edgee::Edgee;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Edgee::from_env()?;

    let response = client.send("anthropic/claude-haiku-4-5", "What is the capital of France?").await?;
    println!("{}", response.text().unwrap_or(""));
    // "The capital of France is Paris."

    Ok(())
}

Send Method

The send() method makes non-streaming chat completion requests:

let response = client.send("anthropic/claude-haiku-4-5", "Hello, world!").await?;

// Access response
println!("{}", response.text().unwrap_or(""));      // Text content
println!("{:?}", response.finish_reason());         // Finish reason
if let Some(tool_calls) = response.tool_calls() {    // Tool calls (if any)
    println!("{:?}", tool_calls);
}

// Access usage and compression info
if let Some(usage) = &response.usage {
    println!("Tokens used: {}", usage.total_tokens);
}

if let Some(compression) = &response.compression {
    println!("Saved tokens: {}", compression.saved_tokens);
    println!("Reduction: {:.1}%", compression.reduction);
    println!("Cost savings: ${:.3}", compression.cost_savings as f64 / 1_000_000.0);
    println!("Time: {} ms", compression.time_ms);
}

Stream Method

The stream() method enables real-time streaming responses:

use tokio_stream::StreamExt;

let mut stream = client.stream("anthropic/claude-haiku-4-5", "Tell me a story").await?;

while let Some(result) = stream.next().await {
    match result {
        Ok(chunk) => {
            if let Some(text) = chunk.text() {
                print!("{}", text);
            }
            
            if let Some(reason) = chunk.finish_reason() {
                println!("\nFinished: {}", reason);
            }
        }
        Err(e) => eprintln!("Error: {}", e),
    }
}

Features

  • ✅ Type-safe - Leverages Rust's powerful type system
  • ✅ Async/await - Built on tokio for efficient async operations
  • ✅ OpenAI-compatible - Works with any model supported by Edgee
  • ✅ Streaming - First-class support with Stream trait
  • ✅ Tool calling - Full support for function calling
  • ✅ Compression info - Access token compression metrics in responses
  • ✅ Zero-cost abstractions - Efficient implementation with minimal overhead

Documentation

For complete documentation, examples, and API reference, visit:

👉 Official Rust SDK Documentation

The documentation includes:

  • Configuration guide - Multiple ways to configure the SDK
  • Send method - Complete guide to non-streaming requests
  • Stream method - Streaming responses guide
  • Tools - Function calling guide

Examples

Run the examples to see the SDK in action:

export EDGEE_API_KEY="your-api-key"
cargo run --example simple
cargo run --example streaming
cargo run --example tools

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

About

The official Rust library for the Edgee AI Gateway

www.edgee.cloud

Topics

aianthropicedgeedge-computingedgeegatewayllmopenairust

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

80 stars

Watchers

4 watching

Forks

10 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.