Octolib
OAuth or API Keys • Reasoning Tracked Separately • Config Migration
The provider layer Octomind and OctoHub are both built on. One type-safe Rust API for 26 AI providers, OAuth into an existing ChatGPT or Claude subscription instead of a new API key, thinking/reasoning tracked separately from content, and a comment-preserving config-migration engine borrowed straight from Octomind's own upgrade path.
Key Features
26 Providers, One Interface
OpenAI, Anthropic, xAI, Google Vertex/Studio, OpenRouter, DeepSeek, Moonshot (Kimi), MiniMax, Z.ai, Amazon Bedrock, Cloudflare, Cerebras, Groq, NVIDIA NIM, Together, Fireworks, Featherless, Hetzner, Alibaba, BytePlus, OpenCode Zen/Go, Ollama, Local, OctoHub — plus CLI proxies for Codex, Claude, Gemini, and Cursor. Swap a string, not the integration.
OAuth or API Keys
OAuth for ChatGPT Plus/Pro/Team/Enterprise and Anthropic is detected automatically and preferred over API keys when present — use a subscription you already pay for instead of standing up a new billed key.
Cross-Provider Tool Calling
Standardized ToolCall and GenericToolCall formats across every provider that supports function calling. Automatic JSON Schema parameter extraction, multi-turn tool results, parallel execution, and provider-specific metadata preserved — including Gemini thought signatures.
Thinking, Tracked Separately
Reasoning content is stored apart from response.content, not mixed into it, across four distinct provider formats: MiniMax content blocks, xAI Responses-API reasoning (with encrypted reasoning preserved across tool rounds), OpenAI o-series reasoning_content, and OpenRouter reasoning_details. reasoning_tokens is tracked separately in TokenUsage too.
Embeddings & Reranking
8 embedding providers (Jina, Voyage, Google, OpenAI, Together, OctoHub, FastEmbed, HuggingFace) and 6 reranking providers (Voyage, Cohere, Jina, Mixedbread, FastEmbed local, HuggingFace) behind one call each. Batch processing, token limits, and input-type hints; local or API-based, swap without touching call sites.
Config Migration Engine
The same comment-preserving TOML upgrade engine Octomind uses internally, exposed as a library feature: file locking, versioned backups, and atomic writes so a breaking config change doesn't clobber what a human wrote or a concurrent process is reading.
Why Octolib?
Provider lock-in makes switching models painful.
A unified, type-safe interface across 26 providers — swapping models is a one-line change, not a second integration to write and maintain.
Each provider has a different auth flow, API shape, and error format.
One interface absorbs the differences: OAuth is tried before falling back to API keys, retries use configurable exponential backoff, and errors are normalized across every provider.
Reasoning content gets mixed into the response or silently dropped.
Thinking is parsed and stored separately from content across four provider formats, with reasoning_tokens tracked apart in TokenUsage — nothing bleeds into what the user sees, nothing goes uncounted.
A breaking config change means every user hand-edits their TOML — and loses their comments.
The migration engine Octomind ships internally is exposed as a library feature: comment-preserving, versioned backups, file locking, atomic writes. Upgrade configs programmatically without clobbering what a human wrote.
When to Use Octolib
Multi-Model Applications
Use one model for complex reasoning, another for long context, another for vision — all through the same API. Switch providers by changing a string, not rewriting integration code.
Bring Your Own Subscription
OAuth into an existing ChatGPT or Claude plan instead of paying per token through a fresh API key — the same auth path Octomind and Octoweb use.
Tool-Calling Agents Across Providers
Build the agent loop once against the standardized ToolCall format, then run it on any provider that supports function calling without a second integration.
RAG & Retrieval Pipelines
Embeddings and reranking through the same crate as completions. Swap local FastEmbed for cloud Voyage without touching application code — or run fully offline.
Install
Build from Source
cargo add octolibTech Stack
Built in the Open
Octolib is open source under the Apache 2.0 license. Contributions, issues, and stars are welcome.