Developer guide
Technical integration guide for extension developers.
Core services
AiRequest Service - Sends provider requests, handles response parsing, and logs request outcomes.
BaseClient - Builds provider-specific request payloads and extracts provider-specific responses.
AiStatistics Service - Fetches OpenAI usage data, transforms result sets, and prepares chart-ready data.
AiEngine Configuration - Exposes configured engines and filters engines based on available API keys.
HttpAuth Utility - Adds basic auth headers and provides protected URL fetch utility behavior.
AiUniverse Utility Helper - Utility methods for extension configuration, TYPO3 version data, and page/language helpers.
Dependency injection
Services are autowired through Configuration/.
Service registration overview
services:
_defaults:
autowire: true
autoconfigure: true
public: false
NITSAN\NsAiUniverse\:
resource: '../Classes/*'
Copied!
Request flow
- Consumer calls
Ai.Request Service:: send Request () - Service merges defaults and incoming options.
Basebuilds provider-specific endpoint + body.Client:: get Request Data () - TYPO3
Requestsends request.Factory Baseextracts generated text.Client:: get Response Data () Aistores status log entry.Log Service
Example integration
Example use in custom service
use NITSAN\NsAiUniverse\Service\AiRequestService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
$ai = GeneralUtility::makeInstance(AiRequestService::class);
$text = $ai->sendRequest(
'openai',
[['role' => 'user', 'content' => 'Summarize this page in 3 bullets.']],
'gpt-4o',
['temperature' => 0.3, 'max_tokens' => 300],
true,
'my_extension',
'summary'
);
Copied!
Embeddings
Use Base and
Base for embedding workflows.
Supported embedding request handlers in code:
- OpenAI
- Gemini
- Mistral
Statistics and caching
Ai:
- fetches OpenAI usage API data
- paginates if needed
- transforms data via
AiUniverse Chart Helper - stores processed results in
nsaiuniverse_cachestatistics - default cache TTL is 24 hours for statistics snapshots
Logging
Request outcomes are written to sys_ via Ai.
Use this for operational tracing and debugging.
Implementation notes
- Provider capabilities and models evolve quickly; keep defaults reviewed.
- Error handling should be explicit around network failures and provider API errors.
- For security-sensitive environments, review how extension configuration is managed.