PHP code example of sdkfabric / openai

1. Go to this page and download the library: Download sdkfabric/openai 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/ */

    

sdkfabric / openai example snippets




nt = new \SdkFabric\Openai\Client::build('[access_token]');

// Creates a model response for the given chat conversation.
$response = $client->completions()->create(new CompletionRequest());

// Delete a stored chat completion.
$response = $client->completions()->delete('completion_id');

// List stored Chat Completions.
$response = $client->completions()->getall('after', 1, 'model', 'order');

// Creates a model response.
$response = $client->responses()->create(new ResponseRequest());