PHP code example of akumi-cloud / sdk

1. Go to this page and download the library: Download akumi-cloud/sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

akumi-cloud / sdk example snippets


use Akumi\Sdk\Akumi;

$akumi = Akumi::fromApiKey('mk_...');

$response = $akumi->chat->create([
    'model' => 'mistral/mistral-large-latest',
    'messages' => [
        ['role' => 'user', 'content' => 'Explain EU data residency in one sentence.'],
    ],
]);

echo $response['choices'][0]['message']['content'];

foreach ($akumi->chat->createStreamed([
    'model' => 'mistral/mistral-large-latest',
    'messages' => [['role' => 'user', 'content' => 'Write a haiku about Frankfurt.']],
]) as $chunk) {
    echo $chunk['choices'][0]['delta']['content'] ?? '';
}

$embeddings = $akumi->embeddings->create([
    'model' => 'mistral/mistral-embed',
    'input' => 'The quarterly report is ready for review.',
]);

$vector = $embeddings['data'][0]['embedding'];