pfrankov63k downloadsA hub for setting AI providers (OpenAI-like, Ollama and more) in one place.
AI Providers manages shared AI provider settings and gives other Obsidian plugins a common API for generation, tool calling, embeddings, and vector retrieval.
Think of it like a control panel where you can:
When another plugin calls the SDK, AI Providers sends generation, tool-calling, and embedding requests to the configured local or remote provider. It also caches embeddings and ranks document chunks locally for vector-based retrieval.
This plugin is available in the Obsidian community plugin store https://obsidian.md/plugins?id=ai-providers
You can install this plugin via BRAT: pfrankov/obsidian-ai-providers
Refreshing models selects the first returned model. An empty list or a failed refresh keeps the current model selection. Capability checkbox edits and accepted Check results save immediately for existing providers; new providers keep them locally until Save.
Changing the provider type, URL, or API key, or closing the form, discards pending refresh/check results. Changing the selected model or editing its capability checkboxes also discards a pending check. Requests already sent to the provider continue running and may still incur charges.
The model capabilities section includes manual reasoning-mode checkboxes for supported adapters. Select only modes documented for your model and endpoint. These are declarations, not automatic detection: Check probes text, embeddings, tools, and vision, and preserves the manual reasoning set. Checking a mode does not change other plugins' requests or set a shared default. A consuming plugin must explicitly select a declared mode for each request.
The checkboxes offer each adapter's wire vocabulary; they do not establish model support. Nothing is selected automatically. Model names are only keys for saved capabilities: changing or adding a model name never needs a code change.
| Provider transport | Request field | Manually selectable vocabulary |
|---|---|---|
| OpenAI Chat Completions | reasoning_effort |
none, minimal, low, medium, high, xhigh, max |
| Z.AI | reasoning_effort |
low, high, max |
| OpenRouter | reasoning.effort |
none, minimal, low, medium, high, xhigh, max |
| Ollama / Open WebUI | top-level think |
true, false, low, medium, high |
The saved per-model declarations are the source of truth for request selection. Select only values supported by your endpoint. The service rejects undeclared values and values outside the adapter vocabulary; remote support is not probed. It does not infer modes, sampling compatibility, tool support or API routing from model names. Native Anthropic reasoning is not implemented.
Omission preserves the API default; it does not mean thinking is disabled.
none, max and xhigh are passed literally. No intensity mapping, token budget,
sampling rewrite or reasoning-specific fallback/retry is added. Sampling and tools
remain as supplied by the consumer. An endpoint may reject their combination with
reasoning; that error is surfaced. Consumers must explicitly omit incompatible
sampling options themselves. This feature adds no sampling-default control.
Contracts: OpenAI reasoning, OpenAI model compatibility, Z.AI, OpenRouter and its per-model metadata, Ollama.
ollama pull gemma2 or any preferred model from the library.Ollama in Provider typegemma2)Additional: if you have issues with streaming completion with Ollama try to set environment variable OLLAMA_ORIGINS to *:
launchctl setenv OLLAMA_ORIGINS "*".OpenAI in Provider typeProvider URL to https://api.openai.com/v1API key from the API keys pagegpt-4o)There are several options to run local OpenAI-like server:
OpenRouter in Provider typeProvider URL to https://openrouter.ai/api/v1API key from the API keys pageanthropic/claude-3.7-sonnet)OpenCode Go in Provider type. The default URL is https://opencode.ai/zen/go/v1./chat/completions (for example, glm-5.2).This adapter supports Chat Completions only. Responses and Messages models and
embeddings are not supported. Model entry is manual because Go's /models list
mixes protocols without identifying the API type. No model is selected automatically;
check the current endpoint table before entering an ID. Unsupported model errors
from the service are surfaced without switching protocols.
OpenCode Go is intended for coding-agent traffic.
Adding the provider does not make a consuming plugin a coding agent or establish
that other uses are permitted. Requests identify this plugin as
obsidian-ai-providers/<version> and include an opaque session UUID. SDK consumers
should reuse conversationId for related calls; without one, each call gets a
fresh UUID that remains stable during SDK retries and transport fallback. Go
always uses the existing Electron/Obsidian HTTP transport, ignoring the developer
Use native fetch setting, because Chromium fetch drops the required User-Agent.
Google Gemini in Provider typeProvider URL to https://generativelanguage.googleapis.com/v1beta/openaiAPI key from the API keys pagegemini-1.5-flash)LM Studio in Provider typeProvider URL to http://localhost:1234/v1gemma2)Groq in Provider typeProvider URL to https://api.groq.com/openai/v1API key from the API keys pagellama3-70b-8192)Docs: How to integrate AI Providers in your plugin.
Provider migration returns false if its confirmation dialog is canceled or
dismissed (including Escape or clicking outside), without adding or saving a
provider. Confirmed migrations resolve with the provider after settings are saved.
Requests using Obsidian's HTTP transport preserve provider error status, headers,
and body for the provider SDK's error handling and retries, including Retry-After.
Cached embeddings are isolated by provider ID, type, full URL, and model. Renaming a provider or rotating its API key preserves cache hits. Changing the model behind an unchanged endpoint/model name, or account-specific routing, cannot be detected by this identity.
Older cache records do not identify their endpoint, so they are retained but ignored. The first subsequent use of each previously cached text recomputes its embedding and sends that text to the current provider again. This one-time lazy rebuild can take time and incur provider charges; no background rebuild or startup provider request is performed. Concurrent writes preserve each call's new entries, but simultaneous misses can still send the same text more than once.
Use Node.js 24 and install the committed dependencies with npm ci.
Run npm run format:check, npm run check, npm run build,
npm run sdk:build, and npm run example:build before submitting a change.
The check command runs lint, tests with 100% coverage thresholds, and type checks.
These checks and builds also run on pull requests.
Quick reference (details in SDK docs):
try {
const finalText = await aiProviders.execute({
provider,
prompt: "Hello",
onProgress: (chunk, full) => {/* stream UI update */},
abortController
});
// use finalText
} catch (e) {
// handle error / abort
}
Tool-calling loops are available via toolsExecute() (SDK 1.7.0 / Service API v4). It is message-only and uses top-level tools / tool_choice, returning an OpenAI-style assistant message (role, content, tool_calls) that you can append directly to messages history.
Ollama tool calls are returned in arrival order across streamed chunks, including
repeated calls, with sequential IDs (call_1, call_2, ...).
Removed callbacks: onEnd / onError — promise resolve/reject covers them (only onProgress remains for streaming). Legacy chainable handler also deprecated.