LatentKit AI Provider

This project is not covered by Drupal’s security advisory policy.

LatentKit AI Provider adds LatentKit to Drupal AI. LatentKit is an AI gateway: one API key for 30+ model providers, with automatic fallback, per-key spend limits, and a log of every request.

Drupal sees a single model, latentkit-route. The route assigned to your LatentKit app key decides which provider and model answer, and in what order to fall back, so you can change models without touching Drupal configuration. The module provides text chat to existing Drupal AI features such as AI CKEditor, AI Automators, AI Chatbot and the AI API Explorer. It does not add its own editor or chatbot.

Status: alpha (1.0.0-alpha1). Security advisory coverage has been requested and is under review.

Features

  • One route-controlled chat model instead of per-provider model settings.
  • Credentials in a Drupal Key or the LATENTKIT_API_KEY server variable. The key is never displayed or exported with configuration.
  • A status page showing the connection, remaining credits, the assigned route and its ordered models, and the provider and model that answered the latest request.
  • System prompts, message history, maximum tokens, temperature, and LatentKit response profiles.
  • Errors name the LatentKit error code (such as KEY_DISABLED or INSUFFICIENT_CREDITS) and request ID, without logging keys, prompts, generated text or provider responses.

Not yet supported: streaming, tool calling, structured (JSON schema) output, embeddings, images and audio.

Installation

The LatentKit PHP SDK is in beta, so require both packages from your project root:

composer require 'drupal/latentkit_ai:^1.0@alpha' 'latentkit/latentkit-php:^0.1.0-beta.4@beta'

Then enable it with drush en latentkit_ai. Composer installs Drupal AI and Key as dependencies.

Post-installation

  1. Create a Key containing your LatentKit app API key under Configuration → System → Keys.
  2. Open Configuration → AI → AI Infrastructure → AI Platform Providers → LatentKit.
  3. Select the Drupal Key and save the provider configuration.
  4. Select LatentKit assigned route when a compatible Drupal AI feature asks for a chat provider and model.

Provider selection, fallback order, and policy are managed through the route assigned to the app in the LatentKit console.

Additional requirements

  • Drupal 10.5 or later, or Drupal 11.2 or later.
  • Drupal AI 1.4 or 1.5.
  • Key 1.22 or later.
  • A LatentKit account with an app API key and an assigned route.
  • Outbound HTTPS access to https://ai.latentkit.com. A self-hosted gateway can be set with the LATENTKIT_BASE_URL server environment variable, using an https:// URL.

External service and privacy

This module connects to LatentKit at https://ai.latentkit.com. It sends the selected API key for authentication. Chat requests send the system prompt, message history, and supported generation settings. The connection-status request retrieves workspace, app, credit, route, model, and recent request metadata.

The module does not automatically send the Drupal site URL, administrator email, or unrelated Drupal content. Review the LatentKit privacy policy and terms before connecting a production site.

Similar projects and how they are different

With LatentKit, Drupal always uses one model. Which models answer, the fallback order and spend limits are managed in the LatentKit console.

Community documentation

Project information

Releases