Skip to content

Call an LLM

Briefing, not authority. (R) rule at linked source · (O) dated upstream fact · (P) procedure · (C) open work · (G) not established.

WHAT THIS MEANS IN DRUPAL

Every chat, embedding or moderation call goes through Drupal AI's provider plugin system, never an SDK or raw HTTP (R) Rule A standard §3.

OWNER

  • Abstraction: drupal/ai; providers are ai_provider_* plugins (R) capability map.
  • Proxy: LiteLLM on Oracle where adopted (R) standard §10 platform stack.
  • Metering, logging: ai_metering, ai_logging / observability (R) capability map.

PREREQUISITES

  1. (P) A provider is configured; its credential is a Key reference to 1Password (R) how-we-build §15.
  2. (P) Decide: field automation (AI Automators), editorial assist, agent, or code call. Prefer config before code.

DO THIS

  1. (P) No code: AI Automators, CKEditor AI, ECA AI actions.
  2. (P) Code: inject the ai.provider service; \Drupal::service() only in procedural code (R) Rule A, best practices §2.1.
  3. (P) Choose models by operation type through config, not hardcoded strings.
  4. (P) Log and meter usage.

WATCH FOR

  • Prompt injection must not bypass access checks, moderation or tool schemas (R) architecture ref.
  • Provider retention, residency and cost ceilings need explicit decisions (G) architecture ref.
  • Stable AI 1.4 preferred over 1.5 RC (O, dated) architecture ref.

DO NOT

  • Direct OpenAI/Anthropic/Bedrock SDK or Guzzle calls (R) Rule A, standard §10 platform stack.
  • Adopt an AI extension that hard-requires one provider: DO_NOT_USE (R) standard §13.
  • Put the key in config, recipe, settings or prompt (R) how-we-build §15.

OWNERSHIP / CAN-SHOULD-MAY

  • CAN: AI admin UI, AI Explorer, injected service.
  • SHOULD: site config owns provider choice; recipe owns reusable automators.
  • MAY: agent entity writes go to draft (R) standard §7.5.

DO NOT REDISCOVER

  • One transport: drupal/ai. No custom Guzzle clients (R) standard §10 platform stack.

CONFLICTS

ID A B Resolution
C-LITELLM standard §10 platform stack order: resolve ai_provider_litellm deletion first matrix: litellm provider enabled on bluefly.io (O 2026-09-20) Open decision. Do not build on LiteLLM-specific behavior until decided.

GO DEEPER

Anchored sources: frontmatter authority_sources. Expires last_verified + 30d.