Plugins
Provider Plugins
Add custom AI providers
Provider Plugins
Provider plugins add new AI services to Chatelope, enabling chat with custom APIs, enterprise deployments, or specialized models.
How Providers Work
- Plugin registers as an AI provider
- User configures the provider (API key, URL, etc.)
- Chatelope sends messages through the plugin
- Plugin handles API communication
- Responses display in the chat
Available Providers
Built-in Providers
- OpenAI (GPT models)
- Anthropic (Claude models)
- Google (Gemini models)
- Ollama (local models)
- LM Studio (local models)
Community Providers
| Provider | Description | Status |
|---|---|---|
| azure-openai | Azure OpenAI Service | Verified |
| aws-bedrock | AWS Bedrock | Verified |
| groq | Groq Cloud | Community |
| together-ai | Together AI | Community |
Using Provider Plugins
After Installation
New providers appear in AI settings:
- Go to Settings > AI Settings
- New provider appears in dropdown
- Configure credentials
- Select models
Configuration
Each provider has its own settings:
- API keys
- Endpoint URLs
- Model selection
- Request parameters
Creating Provider Plugins
See Creating Plugins for the full SDK guide.
Quick Example
import { defineProvider, Message } from '@chatelope/plugin-sdk';
export default defineProvider({
id: 'my-provider',
name: 'My AI Provider',
version: '1.0.0',
// Configuration schema
config: {
apiKey: {
type: 'string',
label: 'API Key',
secret: true,
required: true,
},
baseUrl: {
type: 'string',
label: 'API URL',
default: 'https://api.example.com',
},
},
// List available models
getModels: async (config) => {
const response = await fetch(`${config.baseUrl}/models`, {
headers: { Authorization: `Bearer ${config.apiKey}` },
});
return response.json();
},
// Send messages and stream response
chat: async function* (messages: Message[], config, options) {
const response = await fetch(`${config.baseUrl}/chat`, {
method: 'POST',
headers: {
Authorization: `Bearer ${config.apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: options.model,
messages,
stream: true,
}),
});
// Stream the response
for await (const chunk of streamResponse(response)) {
yield { content: chunk };
}
},
});Provider Interface
interface Provider {
id: string;
name: string;
version: string;
icon?: string;
// Configuration
config: ConfigSchema;
// Methods
getModels(config: Config): Promise<Model[]>;
chat(messages: Message[], config: Config, options: ChatOptions): AsyncGenerator<ChatChunk>;
// Optional
validateConfig?(config: Config): Promise<ValidationResult>;
getUsage?(config: Config): Promise<UsageInfo>;
}Message Types
interface Message {
role: 'user' | 'assistant' | 'system';
content: string;
attachments?: Attachment[];
}
interface ChatOptions {
model: string;
temperature?: number;
maxTokens?: number;
systemPrompt?: string;
}
interface ChatChunk {
content?: string;
done?: boolean;
usage?: TokenUsage;
}Streaming Responses
Providers should stream responses for better UX:
chat: async function* (messages, config, options) {
const stream = await createStream(messages);
for await (const chunk of stream) {
yield { content: chunk.text };
}
yield { done: true, usage: stream.usage };
}Error Handling
Handle API errors gracefully:
chat: async function* (messages, config, options) {
try {
// API call
} catch (error) {
if (error.status === 401) {
throw new ProviderError('Invalid API key', 'auth_error');
}
if (error.status === 429) {
throw new ProviderError('Rate limited', 'rate_limit');
}
throw new ProviderError('API error', 'api_error');
}
}Best Practices
- Stream responses - Better user experience
- Handle rate limits - Implement backoff
- Validate configs - Check credentials early
- Report usage - Track token consumption
- Support cancellation - Handle AbortController
- Document requirements - API key instructions