AI
AI Chat
Send messages to an AI language model and receive a streamed response. Requires `AI_ENABLED=true` and app-level authentication. Streamed as Server-Sent Events.
Request Body
AI provider to use.
Model ID for the selected provider.
Conversation history. Must contain at least one message.
List of tools available to the model. Each entry is either a built-in tool name string or a custom tool definition object.
Per-tool approval mode.
Contextual information for the session.
Up to 10 context attachments (items, visual elements, or prompts).
Responses
// Not supported in Directus SDK
AI Object Extraction
Generate a structured object from a prompt using an AI language model. Requires `AI_ENABLED=true` and app-level authentication. Streams a JSON object matching the provided output schema.
Request Body
AI provider to use.
Model ID for the selected provider.
Prompt describing the object to generate.
JSON Schema 7 definition for the output object.
Maximum number of tokens in the model output. Minimum 256.
Responses
// Not supported in Directus SDK
Upload File for AI
Upload a file to an AI provider for use in subsequent AI requests. Requires `AI_ENABLED=true` and app-level authentication. Supported providers are `openai`, `anthropic`, and `google`. Maximum file size is 50 MB.
Responses
Provider-specific file reference returned after upload.
// Not supported in Directus SDK
{
"data": {}
}