Search by

adachsoft / ai-integration-sogni

Arkadiusz Adach

Sogni provider integration for tool-calling chat and usage normalization in AdachSoft AI Integration.

Package info

gitlab.com/a.adach/ai-integration-sogni

Issues

pkg:composer/adachsoft/ai-integration-sogni

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-11-23 04:37 UTC

This package is auto-updated.

Last update: 2026-11-23 03:37:56 UTC


README

This library connects Sogni Chat Completions to AdachSoft AI Integration. It provides a ready-to-use tool-calling chat SPI and Sogni-specific handling for request options, provider errors, token usage, cached input tokens, and reported USD costs.

Features

  • Creates an OpenAI-compatible Sogni chat SPI from explicit runtime configuration.
  • Disables Sogni-side tool execution while preserving tool-calling requests.
  • Classifies Sogni spend-limit responses as non-retriable errors.
  • Normalizes input, cached input, and output token usage and provider-reported costs.
  • Uses the standard Sogni Chat Completions endpoint by default, with optional custom HTTPS endpoints.

Installation

composer require adachsoft/ai-integration-sogni

Requirements

  • PHP 8.3 or later.
  • An AdachSoft AI Integration application and a Sogni API key.

Usage

Supply the API key from your application's secret management and create the provider SPI:

use AdachSoft\AiIntegrationSogni\Config\SogniConfig;
use AdachSoft\AiIntegrationSogni\SogniToolCallingChatSpiFactory;

$apiKey = getenv('SOGNI_API_KEY');
if (!is_string($apiKey) || $apiKey === '') {
    throw new RuntimeException('SOGNI_API_KEY is not configured.');
}

$spi = (new SogniToolCallingChatSpiFactory(
    new SogniConfig(apiKey: $apiKey),
))->create();

Register the returned ToolCallingChatSpiInterface with the AdachSoft AI Integration component used by your application. The API key is supplied at runtime and must not be committed to source control.

See the integration example for custom endpoint and HTTP client configuration.