Skip to main content

Crate aither

Crate aither 

Source
Expand description

§aither

High level façade crate that re-exports everything from aither_core plus the #[tool] derive. Pull this crate into your binary to build portable AI applications that can talk to OpenAI, Gemini, local models, or any future provider that implements the core traits.

§What’s inside?

  • LanguageModel for streaming chat, emitting llm::Events that carry visible text, reasoning summaries, and tool calls.
  • Audio, image, embeddings, and moderation traits that follow the same ergonomics.
  • #[tool] macros for function-calling schemas, so you can share tool definitions across providers.

§Example

use aither::{LanguageModel, llm::{LLMRequest, Message, collect_text, model::Parameters}};
use aither_openai::OpenAI;

async fn demo(api_key: &str) -> aither::Result<String> {
    let model = OpenAI::new(api_key);
    let request = LLMRequest::new([
        Message::system("You are a creative assistant."),
        Message::user("Plan a day of food in Osaka."),
    ])
    .with_parameters(Parameters::default().include_reasoning(true));

    let response = model.respond(request);
    let answer = collect_text(response).await?;
    Ok(answer)
}

§Modules

Re-exports§

pub use aither_openai as openai;
pub use aither_claude as claude;
pub use aither_gemini as gemini;
pub use aither_llama as llama;
pub use aither_ort as ort;
pub use aither_agent as agent;
pub use aither_rag as rag;
pub use aither_mem0 as mem0;
pub use aither_skills as skills;
pub use aither_browser as browser;
pub use aither_websearch as websearch;
pub use aither_search as search;
pub use aither_webfetch as webfetch;
pub use aither_fs as fs;
pub use aither_command as command;
pub use aither_mcp as mcp;

Modules§

audio
Audio generation and transcription.
embedding
Text embeddings.
image
Text-to-image generation.
llm
Language Models and Conversation Management
moderation
Content moderation utilities.

Structs§

Error
The Error type, a wrapper around a dynamic error type.

Traits§

AudioGenerator
Generates audio from text prompts.
AudioTranscriber
Transcribes audio to text.
EmbeddingModel
Converts text to vector representations.
ImageGenerator
Trait for generating and editing images from prompts and masks.
LanguageModel
Language models for text generation and conversation.
Moderation
Trait for content moderation services.

Type Aliases§

Result
Result type used throughout the crate.

Attribute Macros§

tool
Converts an async function into an AI tool that can be called by language models.