Providers

The SDK supports multiple LLM providers through a unified interface.

Provider Factory

Create providers using the factory function:

import { createProvider, type ProviderCredentials } from '@agentic-work/sdk/providers';

const provider = createProvider({
  type: 'openai',
  apiKey: process.env.OPENAI_API_KEY
});

Supported Providers

OpenAI

const openai = createProvider({
  type: 'openai',
  apiKey: process.env.OPENAI_API_KEY,
  baseUrl: 'https://api.openai.com/v1', // optional
  defaultModel: 'gpt-4o' // optional
});

// Available models
const models = await openai.listModels();
// ['gpt-4o', 'gpt-4-turbo', 'gpt-4o-mini', 'o1-preview', ...]

Anthropic

Google (Gemini)

Google Vertex AI

Azure OpenAI

AWS Bedrock

Ollama (Local)

Provider Interface

All providers implement the same interface:

Completion Options

Making Completions

Non-Streaming

Streaming

Tool Calling

Health Checks

Provider Credentials Reference

Error Handling

Last updated