Skip to main content

Crate nenjo_models

Crate nenjo_models 

Source
Expand description

§nenjo-providers

LLM provider trait, types, and implementations for the Nenjo agent platform.

This crate provides:

Re-exports§

pub use native::EditImageRequest;
pub use native::EditVideoRequest;
pub use native::ExtendVideoRequest;
pub use native::GenerateImageRequest;
pub use native::GenerateSpeechRequest;
pub use native::GenerateVideoRequest;
pub use native::ImageToVideoRequest;
pub use native::MediaInputAsset;
pub use native::MediaOutputAsset;
pub use native::MediaOutputFormat;
pub use native::ModelNativeCapabilities;
pub use native::NativeCapabilitiesProvider;
pub use native::NativeExecutionMode;
pub use native::NativeMediaJob;
pub use native::NativeMediaJobStatus;
pub use native::NativeMediaRequest;
pub use native::NativeMediaResponse;
pub use native::NativeModelToolId;
pub use native::NativeOperation;
pub use native::NativeToolSpec;
pub use native::ProviderNativeCapabilities;
pub use native::ProviderNativeModelToolSpec;
pub use native::ReferenceToVideoRequest;
pub use native::TranscribeAudioRequest;
pub use traits::ChatMessage;
pub use traits::ChatRequest;
pub use traits::ChatResponse;
pub use traits::ConversationMessage;
pub use traits::ModelProvider;
pub use traits::ProviderStreamEvent;
pub use traits::ProviderToolTrace;
pub use traits::TokenUsage;
pub use traits::one_shot;
pub use anthropic::AnthropicProvider;
pub use compatible::AuthStyle;
pub use compatible::OpenAiCompatibleProvider;
pub use gemini::GeminiProvider;
pub use ollama::OllamaProvider;
pub use openai::OpenAiProvider;
pub use openrouter::OpenRouterProvider;
pub use reliable::ReliableProvider;
pub use router::RouterProvider;
pub use xai::XAI_DEFAULT_BASE_URL;
pub use xai::XAiProvider;

Modules§

anthropic
Anthropic Claude provider. Authenticates via x-api-key header.
compatible
Generic OpenAI-compatible provider. Most LLM APIs follow the same /v1/chat/completions format. This module provides a single implementation that works for all of them.
gemini
Google Gemini provider with support for:
native
Provider-native media and model capability contracts.
ollama
Local Ollama provider. No authentication required, configurable base URL (defaults to http://localhost:11434).
openai
OpenAI provider. Authenticates via Bearer token.
openrouter
OpenRouter aggregator provider. Authenticates via Bearer token, routes to multiple upstream models with provider-order pinning.
reliable
Reliability wrapper providing exponential-backoff retries, provider fallback, API key rotation, and model failover.
router
Multi-model router that dispatches requests to different provider+model combinations based on hint-prefixed model names.
traits
xai
xAI provider.

Structs§

ToolCall
A tool call requested by the LLM.
ToolResultMessage
A tool result to feed back to the LLM.
ToolSpec
Full specification of a tool for LLM registration.

Enums§

ToolCategory
Classifies a tool’s side-effect profile for filtering and model guidance.

Traits§

ModelProviderFactory
Maps a model provider name (for example, "openai" or "anthropic") to an LLM provider implementation.
TypedModelProviderFactory
Typed variant of ModelProviderFactory using a generic associated model provider type.

Functions§

api_error
Build a sanitized provider error from a failed HTTP response.
sanitize_api_error
Sanitize API error text by scrubbing secrets and truncating length.
sanitize_tool_name
Sanitize a tool function name to match the strict OpenAI pattern ^[a-zA-Z0-9_-]+$.
sanitize_tool_name_lenient
Light sanitization for lenient providers (Ollama) while preserving dots used in MCP namespaced tool names.
scrub_secret_patterns
Scrub known secret-like token prefixes from provider error strings.
strip_thinking
Strip <think>…</think> blocks from model output.