ai_provider_openai_compatible
9 sites
No security coverage
This module provides a flexible AI provider for OpenAI compatible APIs, Including
Features
- OpenAI API Compatibility: Works with any service that implements the OpenAI API specification
- DeepSeek Support: Built-in support for DeepSeek models with example configurations
- Flexible Model Configuration: Define custom models via YAML configuration
- Dynamic Capabilities: Model capabilities are configurable per model
- Key Module Integration: Uses Drupal's Key module for secure API key storage
Post-Installation
1. API Key Setup
- 1. Create a new key in the Key module (`/admin/config/system/keys/add`)
- 2. Select "Authentication" as the key type
- 3. Enter your API key in the "Key value" field
- 4. Save the key
2. Provider Configuration
Navigate to `/admin/config/ai/providers/openai-compatible` and configure:
- API Key: Select the key you created
- API Endpoint: Enter the base URL (e.g., `https://api.deepseek.com`)
- Models Configuration: Optional YAML configuration for custom models
Configuration Fields
- label: Human-readable name for the model
- operation_types: Array of supported operation types (`chat`, `embeddings`, etc.)
- capabilities: Array of model capabilities (see below)
- parameters: Model-specific parameters (temperature, max_tokens, etc.)
Supported Capabilities
The module supports all capabilities defined in the AI module's `AiModelCapability` enum:
- `chat_with_image_vision`: Chat with image vision support
- `chat_with_audio`: Chat with audio support
- `chat_with_video`: Chat with video support
- `chat_system_role`: Chat with system role support
- `chat_json_output`: Chat with JSON output support
- `chat_structured_response`: Chat with structured response support
- `chat_tools`: Chat with tools/function calling support
- `chat_combined_tools_and_structured_response`: Chat with both tools and structured response
Usage with DeepSeek
DeepSeek Configuration Example
- 1. Get your API key from [DeepSeek Platform](https://platform.deepseek.com/)
- 2. Create a key in Drupal's Key module with your DeepSeek API key
- 3. Configure the provider:
- - API Endpoint: `https://api.deepseek.com`
- - Use the key created above
Available DeepSeek Models
- `deepseek-chat`: General chat model
- `deepseek-reasoner`: Advanced reasoning model with structured response support
Extending for Other Providers
To add support for other OpenAI compatible providers:
- 1. Update the YAML configuration with your provider's models
- 2. Adjust the API endpoint to your provider's URL
- 3. Configure model capabilities based on what your provider supports
Additional Requirements
- Drupal 10.3+ or 11+
- AI module (>= 1.2.0)
- Key module