Installing the SDK
The SDK is distributed as an npm package and can be installed using your preferred package manager.Adding to package.json
The SDK will automatically be added to yourpackage.json dependencies:
package.json
Importing SDK Styles
The SDK includes a fallback settings tab UI that requires styles to be imported. Add the following import to your plugin’s main stylesheet:styles.css
The SDK styles are required for the fallback settings tab that appears when the AI Providers plugin is not yet loaded or activated.
esbuild Configuration
You must configure your esbuild setup to load CSS files. Update youresbuild.config.mjs file:
esbuild.config.mjs
Alternative: Copy Styles Manually
If you prefer not to configure the CSS loader, you can manually copy the contents of@obsidian-ai-providers/sdk/styles.css into your own stylesheet.
styles.css file.
Version Compatibility
The SDK uses semantic versioning and maintains compatibility requirements with the AI Providers plugin:SDK Version 1.5.0+
Requires AI Providers plugin Service API v3 or higher. This version introduces:
execute()returnsPromise<string>with inline streaming viaonProgress- Cancellation support via
AbortController - Deprecated chainable
IChunkHandler(legacy compatibility only)
Compatibility Check
The SDK automatically checks version compatibility when initializing. If the installed AI Providers plugin is incompatible, a fallback settings tab will be shown.
Migration Guides
If upgrading from older SDK versions, refer to the migration guides:
The SDK is designed to work with Obsidian’s plugin API. Ensure your plugin’s
manifest.json specifies a minimum Obsidian version that supports the features you’re using.