oxi-ai 0.6.2

Unified LLM API — multi-provider streaming interface for AI coding assistants
Documentation
#![allow(unused_doc_comments)]
#![warn(missing_docs)]
#![warn(clippy::unwrap_used)]
#![allow(clippy::unwrap_used_in_tests)]

//! oxi-ai: Unified LLM API for oxi
//!
//! This crate provides a unified interface for interacting with multiple LLM providers.
//! It handles streaming, tool calling, context management, and cross-provider handoffs.

mod compaction;
mod context;
pub mod env_api_keys;
mod error;
mod high_level;
mod messages;
pub mod oauth;
pub mod provider_registry;
mod providers;
pub mod secret;
mod tools;
mod transform;
mod types;
pub mod utils;

/// Standard imports for oxi-ai usage.
pub mod prelude {
    pub use crate::compaction::{
        CompactedContext, CompactionManager, CompactionStrategy, Compactor, LlmCompactor,
    };
    pub use crate::context::Context;
    pub use crate::error::{Error, Result};
    pub use crate::messages::*;
    pub use crate::providers::{Provider, ProviderEvent, StreamOptions};
    pub use crate::tools::{validate_args, Tool};
    pub use crate::types::*;
}

// Re-export main types
pub use crate::error::ProviderError;
pub use context::Context;
pub use error::{Error, Result};
pub use messages::*;
pub use providers::CacheRetention;
pub use providers::{get_provider, register_provider, unregister_provider, custom_provider_names, Provider, ProviderEvent, StreamOptions};
pub use providers::OpenAiProvider;
pub use providers::model_fetch::fetch_models_blocking;
pub use providers::OpenAiResponsesProvider;
pub use tools::{progress_callback, validate_args, ProgressCallback, Tool, ValidationError};
pub use types::*;

// High-level API
pub use high_level::tokens::{context_usage, estimate, estimate_words};
pub use high_level::{complete, estimate_tokens};

// Context compaction
pub use compaction::{
    CompactedContext, CompactionManager, CompactionStrategy, Compactor, LlmCompactor,
};

// Cross-provider message transformation
pub use transform::{
    anthropic_to_google, anthropic_to_openai, google_to_openai, normalize_tool_call_id,
    openai_to_anthropic, transform_messages, transform_messages_for_model, TransformOptions,
};

// Model registry (runtime mutable registry)
mod model_registry;
pub use model_registry::{get_model, get_models, get_providers, register_model, unregister_model, lookup_model, ModelRegistry};

// Static model database (comprehensive)
pub mod model_db;
pub use model_db::{
    get_all_models, get_cheapest_models, get_model_entry, get_provider_models,
    get_reasoning_models, get_vision_models, model_count, search_models, ModelEntry,
};

/// Re-export AssistantMessage from messages
pub use messages::AssistantMessage;

// Environment-based API key resolution
pub use env_api_keys::{find_env_keys, get_all_env_keys, get_env_api_key};

// Provider authentication registry
pub use provider_registry::{OAuthTokenInfo, ProviderAuth, ProviderAuthRegistry};