fuc-new/vendor/openai-php/client/src/OpenAI.php
hellcat 1fe8673f62 1
2025-10-01 13:34:29 +08:00

30 lines
648 B
PHP
Executable File

<?php
declare(strict_types=1);
use OpenAI\Client;
use OpenAI\Factory;
final class OpenAI
{
/**
* Creates a new Open AI Client with the given API token.
*/
public static function client(string $apiKey, ?string $organization = null): Client
{
return self::factory()
->withApiKey($apiKey)
->withOrganization($organization)
->withHttpHeader('OpenAI-Beta', 'assistants=v2')
->make();
}
/**
* Creates a new factory instance to configure a custom Open AI Client
*/
public static function factory(): Factory
{
return new Factory();
}
}