Supported AI Providers
Directus supports the following AI providers out of the box:- OpenAI - GPT-4, GPT-5 series models
- Anthropic - Claude models (Haiku, Sonnet, Opus)
- Google - Gemini models
- OpenAI-Compatible - Custom endpoints compatible with OpenAI API
Configuration
OpenAI
Anthropic
OpenAI-Compatible Provider
Available Models
Directus includes definitions for popular AI models with their capabilities and pricing:OpenAI Models
- gpt-4o-mini - Fast, cost-effective (128k context)
- gpt-4.1-nano - Entry-level GPT-4.1 (1M context)
- gpt-4.1-mini - Balanced GPT-4.1 (1M context)
- gpt-4.1 - Full GPT-4.1 (1M context)
- gpt-5-nano - Entry-level GPT-5 with reasoning (400k context)
- gpt-5-mini - Balanced GPT-5 with reasoning (400k context)
- gpt-5 - Standard GPT-5 with reasoning (400k context)
- gpt-5.2 - Latest GPT-5 with reasoning (400k context)
- gpt-5.2-pro - Premium GPT-5 with reasoning (400k context)
Anthropic Models
- claude-haiku-4-5 - Fast, cost-effective (200k context)
- claude-sonnet-4-5 - Balanced with reasoning (200k context)
- claude-opus-4-5 - Most capable with reasoning (200k context)
Google Models
- gemini-2.5-flash - Fast, cost-effective (1M context)
- gemini-2.5-pro - Balanced (1M context)
- gemini-3-flash-preview - Next-gen flash (1M context)
- gemini-3-pro-preview - Next-gen pro (1M context)
Model Capabilities
Each model definition includes:Using AI in Flows
AI can be integrated into flows for automated content processing:AI Operation Example
AI Tools
Directus AI supports tool calling for structured outputs:Available System Tools
- items - Read/write collection items
- files - Access file metadata
- folders - Manage file folders
- assets - Work with uploaded assets
- flows - Interact with flows
- trigger-flow - Execute flows
- operations - Flow operations
- schema - Database schema info
- collections - Collection metadata
- fields - Field definitions
- relations - Relationship metadata
Tool Approval Modes
- always - AI can use tools without confirmation
- ask - Require user approval before tool execution
- disabled - Tools not available to AI
File Attachments
Models withattachment: true support image and file inputs:
Reasoning Models
Models withreasoning: true support chain-of-thought:
- Think step-by-step before responding
- Provide explanation of their reasoning
- Better at complex analysis and problem-solving
- Higher cost and latency
Context Management
Context Limits
Each model has a maximum context window:Prompt Optimization
Cost Tracking
Track AI usage and costs:Custom Models
Define custom models for OpenAI-compatible APIs:Streaming Responses
Stream AI responses for better UX:Error Handling
Best Practices
Choose the Right Model
Choose the Right Model
Use faster, cheaper models (mini/nano) for simple tasks. Reserve premium models (opus/pro) for complex reasoning.
Optimize Context Usage
Optimize Context Usage
Keep prompts concise and only include necessary context to reduce costs and latency.
Implement Rate Limiting
Implement Rate Limiting
Set up rate limits to prevent runaway API costs from automated flows.
Cache Common Responses
Cache Common Responses
Cache frequently requested AI generations to reduce API calls.
Monitor Costs
Monitor Costs
Track token usage and costs, especially in production environments.