Install

Works with Drupal: ^10.5 || ^11.2

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 44.92 KB
MD5: bd7c103a38e3d4c6cbf97d99c97de914
SHA-1: aa542310bae53a985777501f062c0a0fe6f79e6d
SHA-256: 0f9024e993742094ae52b577e2a1081cb26ac42b35bca303f62b1277c743e0dc
Download zip 64.58 KB
MD5: abfe1767d84de37a60907e7c674f2187
SHA-1: 756e56f336b123c8cf829ad74a67612b01c0c106
SHA-256: cf5cfb0f997d7b76945f7888bd95651f6575c9d5028bc011548df62fadaa0ce7

Release notes

Second beta of the 1.1.x line. It brings the provider in line with changes in TypeSafe's official SDKs since their
first public release (Python 0.6.0 to 0.7.2, JavaScript 0.6.0) and fixes an API key leak. No configuration changes or
database updates are needed.

Requirements

  • Drupal ^10.5 || ^11.2
  • AI ^1.6. Until AI 1.6.0 is released, use AI's 1.6.x development branch:

    composer require 'drupal/ai:1.6.x-dev@dev' 'drupal/ai_provider_typesafeai:1.1.0-beta2'

Fixed: API key leak

In 1.1.0-beta1, an API key with a trailing newline made the HTTP library reject the Authorization header
with an error message that contained the full key. Such keys are common with file- or environment-backed Key providers.
That message was shown in the settings form and written to the log.

Keys are now trimmed and checked before any request. A key that is empty, or that contains whitespace, control or
non-ASCII characters, fails with AiSetupFailureException, and error messages never contain the key.

If your key value could have ended with a newline, search your logs for is not valid header value. If you
find it, rotate the key.

New

  • Request IDs. TypeSafe's x-typesafe-request-id is quoted in API error messages, for
    example TypeSafe API error (HTTP 422, request ID req_…). It is also returned as request_id in the metadata of Decision, Text classification and Moderation outputs, and as the typesafeai_request_id debug value. Quote it in TypeSafe support requests.
  • AI gateway documentation. The README lists the API base URLs for the Vercel AI Gateway and the
    Pydantic AI Gateway. Enter them under Advanced → API base URL, including /v1. OpenRouter is not supported yet: its model list uses a different format, so the settings form cannot verify the key.

Changed

  • Missing-key errors. The API reports a missing key as HTTP 403 with
    authentication_error. This now maps to AiSetupFailureException, like 401, instead of
    AiAccessDeniedException.
  • Retries follow the SDKs' current default policy.
    • A call stops retrying when the next delay would take it past 30 seconds in total. An attempt that hit AI's
      request timeout (60 seconds by default) is therefore no longer retried twice inside the same web request.
    • retry-after-ms is honoured, and takes precedence over Retry-After. Both stay capped at 5 seconds.
    • Jitter now only shortens backoff delays, so no delay exceeds 5 seconds.

For developers

  • TypeSafeAiClient's constructor now throws AiSetupFailureException for an unusable key and \InvalidArgumentException for out-of-range retry settings. It gains optional trailing
    $retryBudgetMs (default 30000; NULL disables it) and $clock arguments. Existing positional arguments are unchanged.
  • TypeSafeAiClient also gains normalizeApiKey(), getLastRequestId(), and the REQUEST_ID_HEADER and DEFAULT_RETRY_BUDGET_MS constants.
  • New tests cover key handling, request IDs, the 403 mapping and the retry policy. A regression test checks that score
    levels are always sent as a JSON list. The SDKs made that form mandatory in 0.6.0; this provider already sent it.

Tested with

AI 1.6.x at d6c0eb17b, Drupal 11.4 and PHP 8.4. A live smoke battery of 33 checks passed against jev-latest (jev-1.13.0).

Commits since 1.1.0-beta1

  • Document AI gateway base URLs (f99a560)
  • Test that score criteria are always sent as a JSON list (ccc6285)
  • Align retries with the TypeSafe SDK default retry policy (b4bdc2b)
  • Validate the API key before use so errors never echo it (4e9e13b)
  • Map 403 authentication_error responses to AiSetupFailureException (8bdbace)
  • Expose TypeSafe request ID in errors and output metadata (6106d0e)
  • Update changelog wording for AI's input validation convention (1cbc126)
Created by: markusa
Created on: 7 Oct 2026 at 02:59 UTC
Last updated: 7 Oct 2026 at 03:00 UTC
Bug fixes
New features

Other releases