Download the PHP package xddesigners/silverstripe-ai without Composer

On this page you can find all versions of the php package xddesigners/silverstripe-ai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-ai

silverstripe-ai

Core AI platform integration for SilverStripe, built on Symfony AI. Provides a unified AIClient service and a /ai/generate endpoint that works with OpenAI, Anthropic, Google (Gemini & Vertex AI), Azure OpenAI, Mistral, Ollama, OpenRouter, and any OpenAI-compatible endpoint.

Requirements

Installation

Configuration

Add the following to your .env file:

Supported platforms and models

Platform type Example models Extra environment variables
openai gpt-4o, gpt-4o-mini, gpt-3.5-turbo —
anthropic (claude) claude-sonnet-4-6, claude-haiku-4-5 —
gemini (google) gemini-2.0-flash, gemini-1.5-pro —
azure your deployment name AI_PLATFORM_BASE_URL (resource endpoint), AI_AZURE_DEPLOYMENT, AI_AZURE_API_VERSION (default 2024-10-21)
vertex gemini-1.5-pro AI_VERTEX_LOCATION, AI_VERTEX_PROJECT (key optional; ADC supported)
mistral mistral-large-latest, mistral-small-latest — (native bridge; AI_PLATFORM_BASE_URL only used for the generic fallback)
ollama any locally pulled model AI_PLATFORM_BASE_URL (optional; defaults to http://localhost:11434)
openrouter any OpenRouter slug, e.g. anthropic/claude-sonnet-5 AI_PLATFORM_BASE_URL (optional; set to route in-region — see below)
generic any model on the endpoint AI_PLATFORM_BASE_URL (required) — any OpenAI-compatible endpoint

mistral uses the native Symfony Mistral bridge (bundled), falling back to Mistral's OpenAI-compatible EU endpoint if that package is removed. ollama and generic reach their providers through the OpenAI-compatible generic bridge, so no extra package is needed.

EU data residency

Keep inference inside the EU by pointing an OpenAI-compatible platform at an in-region endpoint via AI_PLATFORM_BASE_URL:

Other EU-friendly options: mistral (Mistral’s EU platform, the default endpoint), azure in an EU region, or ollama/generic against a model you host in the EU — data then never leaves your infrastructure.

Optional YAML configuration

You can override AIClient defaults in YAML:

Usage

In PHP

Inject or instantiate AIClient and call one of its two methods:

Via the HTTP endpoint

The module registers a /ai/generate route that accepts POST requests.

Text mode

Response:

Fields mode

Response:

Error responses

Status Meaning
400 Missing or invalid input
429 Rate limit exceeded (includes retry_after_seconds)
500 AI generation failed

Usage logging & the AI Usage admin

Every request is logged to AIRequestLog (platform, model, mode, token counts and estimated cost) and can be browsed under the AI Usage CMS section.

Token usage is captured for every supported provider. Native bridges (OpenAI, Anthropic, Gemini, Vertex AI, Mistral) report it through Symfony AI's token_usage metadata; for OpenAI-compatible endpoints that don't surface that metadata (OpenRouter, Ollama, the generic bridge) the counts are read from the response's usage block as a fallback. Cost is only estimated when the model is listed in model_pricing (see below) — otherwise the request is logged with token counts but no cost.

Who can see it

Hiding it from clients

Set this in .env to hide the section entirely (menu + access), for everyone including admins:

Currency (default USD)

The summary and the per-row cost show the estimate in USD by default, because provider pricing is in USD. To display another currency, set the symbol and an optional USD→currency rate — the stored value stays USD; the rate only affects display:

The figure remains an estimate, so set currency_rate to whatever approximate rate you want reflected.

Privacy & data processing

This module sends the text you pass to AIClient — page content, field values, prompts — to the third-party AI provider you configure. Treat that as a data-processing step:

Extending: custom platforms & models

Extra models need no code. Set AI_MODEL to any model your platform supports, and (for cost estimates) add its rate under model_pricing — see Optional YAML configuration.

Extra platforms / providers are added in code via the updatePlatform extension hook on AIClient. A "platform" is any Symfony AI PlatformInterface — a bundled bridge factory or your own implementation. Return one from the hook to add a new AI_PLATFORM_TYPE, or to override a built-in one. Token usage, cost estimation and request logging are handled by AIClient for any platform, so nothing else is required.

Then set AI_PLATFORM_TYPE="myprovider" (plus AI_MODEL, and optional model_pricing). For a fully custom provider, implement Symfony AI's PlatformInterface yourself — see the Symfony AI platform docs.

Extending the controller

By default the endpoint is POST-only and AIController::assertAccess() requires a logged-in member (returning Security::permissionFailure() otherwise). Subclass the controller to add your own permission logic — return an HTTPResponse to deny, or null to allow:

Then update the route in YAML:

Suggested modules

License

BSD-3-Clause © XD Designers


All versions of silverstripe-ai with dependencies

PHP Build Version
Package Version
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package xddesigners/silverstripe-ai contains the following files

Loading the files please wait ...