aimux API reference
August 13, 2026 · View on GitHub
Lookup index for the public API surface. Rust is the source of truth; TypeScript declarations in
bindings/node/src/types/are generated by ts-rs and mirror the JSON shapes that flow through the FFI boundary (all bindings use the same shapes). Full provider list: providers.md.
Types
| Type | Rust source | TS declaration | Notes |
|---|---|---|---|
GenerateTextOptions | generate.rs | GenerateTextOptions.ts | per-call text options (temperature, tools, reasoning, timeout, …) |
CallOptions | options.rs | CallOptions.ts | base options for all modalities |
TimeoutConfiguration | options.rs | TimeoutConfiguration.ts | total_ms / first_chunk_ms / chunk_ms |
ResponseFormat | options.rs | ResponseFormat.ts | text / json_object / json_schema |
ReasoningEffort | types.rs | ReasoningEffort.ts | 7 levels, passed through verbatim |
AbortSignal | shared.rs | — (runtime handle) | Rust: options field; Node: AbortBridge + JS AbortSignal |
ProviderOptions | provider.rs | ProviderConfig (per binding) | base_url / headers / organization / project / max_retries / body_overrides |
ProviderName | provider_name.rs | ProviderName.ts | one constant per registry provider (251); also generated for Go / Python / Java / Kotlin / Swift / Dart (scripts/gen_provider_names.py) |
GenerateTextResult | generate.rs | GenerateTextResult.ts | text, tool_calls, usage, warnings, raw |
StreamTextResult | generate.rs | — | use StreamPart while iterating |
StreamPart | stream_part.rs | StreamPart.ts | TextDelta / ToolCallDelta / Finish / … |
Usage / TokenUsage | types.rs | Usage.ts | input/output/reasoning tokens |
FinishReason / FinishReasonUnified | types.rs | FinishReason.ts | |
Warning | types.rs | Warning.ts | non-fatal provider notices |
AiMuxError | error.rs | AiMuxError.ts | typed error with error_type + status_code |
ModelMessage / Role / MessageContent / ModelPrompt | message.rs | ModelMessage.ts | chat message shapes |
LanguageModelPromptMessage | language_model_message.rs | LanguageModelPromptMessage.ts | canonical prompt message |
ContentPart | content.rs | ContentPart.ts | Text / Reasoning / ToolResult / … |
Tool / FunctionTool / ProviderTool | tool.rs | Tool.ts | tool definitions |
ToolCall / ToolResult / ToolChoice | tool.rs | ToolCall.ts | tool invocation plumbing |
| Embedding types | embedding_model.rs | Embedding*.ts | EmbeddingCallOptions / EmbeddingResult / EmbeddingResponse |
| Image types | image_model.rs | Image*.ts | ImageCallOptions / ImageResult / ImageResponse / ImageFile |
| Speech types | speech_model.rs | Speech*.ts | SpeechCallOptions / SpeechResult / AudioData |
| Transcription types | transcription_model.rs | Transcription*.ts | TranscriptionCallOptions / TranscriptionResult / TranscriptionSegment |
| Video types | video_model.rs | Video*.ts | VideoCallOptions / VideoResult / VideoData |
| Reranking types | reranking_model.rs | Reranking*.ts | RerankingCallOptions / RerankingResult / RerankingRank |
| Search types | search_model.rs | Search*.ts | SearchCallOptions / SearchResult / SearchResultItem |
| Files types | files_model.rs | UploadFile*.ts | UploadFileCallOptions / UploadFileResult |
| Shared | shared.rs | FileBytes.ts / FileData.ts / Size.ts / AspectRatio.ts |
Functions
Native protocols
| Provider | Rust | Node / Python | Go / Java | Kotlin / Swift / Flutter | C ABI |
|---|---|---|---|---|---|
| OpenAI | OpenAIProvider::new(OpenAIConfig::new(key)) | openai(apiKey, model, baseUrl?) | NewOpenAI(...) / Model.openai(...) | Model.openai(...) / Aimux.openai(apiKey:modelId:) | aimux_openai_new |
| Anthropic | AnthropicProvider::new(AnthropicConfig::new(key)) | anthropic(apiKey, model, baseUrl?) | NewAnthropic(...) / Model.anthropic(...) | Model.anthropic(...) / Aimux.anthropic(apiKey:modelId:) | aimux_anthropic_new |
GoogleProvider | google(apiKey, model, baseUrl?) | — | — | — | |
| DeepSeek (registry) | provider("deepseek", ...) | deepseek(...) | NewDeepSeek(...) / Model.deepseek(...) | — | aimux_provider_new("deepseek", ...) |
| Cohere | CohereProvider | cohere(apiKey, model, baseUrl?) | NewCohere(...) / Model.cohere(...) | Model.cohere(...) / Aimux.cohere(...) | aimux_cohere_new |
| Mistral | MistralProvider | mistral(apiKey, model, baseUrl?) | NewMistral(...) / Model.mistral(...) | Model.mistral(...) / Aimux.mistral(...) | aimux_mistral_new |
| xAI | XAIProvider | xai(apiKey, model, baseUrl?) | NewXai(...) / Model.xai(...) | Model.xai(...) / Aimux.xai(...) | aimux_xai_new |
| Bedrock | BedrockProvider | bedrock(accessKeyId, secretKey, region, model, baseUrl?) | NewBedrock(...) / Model.bedrock(...) | Model.bedrock(...) / Aimux.bedrock(...) | aimux_bedrock_new |
| Vertex | VertexProvider | vertex(accessToken, project, location, model, baseUrl?) | NewVertex(...) / Model.vertex(...) | Model.vertex(...) / Aimux.vertex(...) | aimux_vertex_new |
| Anthropic-AWS | AnthropicAwsProvider | anthropicAws(apiKey, region, model, baseUrl?) | NewAnthropicAws(...) / Model.anthropicAws(...) | Model.anthropicAws(...) / Aimux.anthropicAws(...) | aimux_anthropic_aws_new |
| Azure | AzureProvider | azure(apiKey, resource, deployment, apiVersion?, baseUrl?) | NewAzure(...) / Model.azure(...) | Model.azure(...) / Aimux.azure(...) | aimux_azure_new |
— = not exposed in that binding yet (Google is Rust / Node / Python only).
Every constructor has a base-URL variant (WithBase / baseUrl overload).
The remaining 65 providers (speech, transcription, image, video, local inference, search, standalone OpenAI-compatible, Vertex-hosted) each have a typed Rust constructor — full list, one entry per provider: providers.md. Their per-binding modality factories are in the function tables below.
Core (Rust, aimux_providers / aimux_core)
| Function | Signature (abridged) | Notes |
|---|---|---|
provider | provider(name, api_key, model_id, options) -> Box<dyn LanguageModel> | registry lookup; unknown name → NoSuchProvider |
provider_from_env | provider_from_env(name, model_id, options) | key read from the registry entry's env var |
provider_registry_entry | -> Option<OpenAICompatProfile> | inspect a registry profile |
generate_text | (model, prompt, options) -> GenerateTextResult | non-streaming |
stream_text | (model, prompt, options) -> StreamTextResult | streaming |
Per-modality entry points are trait methods on the model types
(EmbeddingModel, ImageModel, SpeechModel, …) — see
API.md §Features.
Node (@arcships/aimux)
| Function | Notes |
|---|---|
generateText(model, prompt, options?, signal?) / streamText(...) | typed wrappers; signal = AbortSignal |
openai() / anthropic() / deepseek() / google() | native typed path; deepseek() is registry-backed |
provider(name, apiKey?, modelId, config?) | registry-backed (251); typed ProviderName |
openaiEmbedding / cohereEmbedding / googleEmbedding | embeddings |
openaiSpeech / openaiTranscription | speech / STT |
openaiImage / googleImage / googleVideo | image / video |
openaiFiles / cohereReranking / tavilySearch | files / rerank / search |
AbortBridge | wraps a JS AbortSignal for the raw napi API |
Python (aimux)
| Function | Notes |
|---|---|
generate_text(model, prompt, options?) / stream_text(...) | typed wrappers |
openai / anthropic / deepseek / provider | same semantics as Node; deepseek registry-backed |
openai_embedding / cohere_embedding / google_embedding | embeddings |
openai_speech / openai_transcription | speech / STT |
openai_image / google_image / google_video | image / video |
openai_files / cohere_reranking / tavily_search | files / rerank / search |
Go (github.com/arcships/aimux/bindings/go)
| Function | Notes |
|---|---|
Provider(name, apiKey?, modelId, config?) | registry-backed; typed ProviderName |
NewOpenAI / NewAnthropic / NewDeepSeek | native typed path (+ WithBase variants) |
NewOpenAIEmbedding / NewCohereEmbedding / NewGoogleEmbedding | embeddings |
NewOpenAISpeech / NewOpenAITranscription | speech / STT |
NewOpenAIImage / NewGoogleImage / NewGoogleVideo | image / video |
NewOpenAIFiles / NewCohereReranking / NewTavilySearch | files / rerank / search |
Java / Kotlin / Flutter (Model.*) and Swift (Aimux.*)
| Function | Notes |
|---|---|
provider(name, apiKey?, modelId, config?) | registry-backed |
openai(apiKey, modelId) / anthropic(apiKey, modelId) | native typed path (+ WithBase/baseUrl variants; Swift: Aimux.openai(apiKey:modelId:)) |
| modality classes | EmbeddingModel / SpeechModel / ImageModel / TranscriptionModel / VideoModel / RerankingModel / SearchModel / Files, each with openai / cohere / google … factories |
C ABI (aimux-ffi)
All functions communicate via JSON strings. Entry points are declared in
aimux-ffi.h: provider_new (registry lookup),
model constructors (openai_new, anthropic_new, …), *_generate,
*_stream (push-callback), *_embed / *_speech / … per modality, and the
*_free family.
Providers
The complete list — 251 registry-backed (name / display / env var / base URL)
and 76 typed-factory providers grouped by category — is in
providers.md. It is generated from
aimux-providers/src/provider_registry.json + aimux-providers/src/lib.rs:
python scripts/gen_providers_doc.py.