{"id":15697156,"url":"https://github.com/softcreatr/php-openai-sdk","last_synced_at":"2025-05-07T14:05:36.128Z","repository":{"id":148390249,"uuid":"615156303","full_name":"SoftCreatR/php-openai-sdk","owner":"SoftCreatR","description":"A powerful and easy-to-use PHP SDK for the OpenAI API, allowing seamless integration of advanced AI-powered features into your PHP projects.","archived":false,"fork":false,"pushed_at":"2025-04-23T10:35:31.000Z","size":641,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T14:05:34.977Z","etag":null,"topics":["api","api-wrapper","artificial-intelligence","dall-e","gpt","gpt-3","gpt-4","hacktoberfest","machine-learning","natural-language-processing","nlp","openai","php","php-library","sdk"],"latest_commit_sha":null,"homepage":"https://platform.openai.com/docs","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SoftCreatR.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"softcreatr","custom":["https://ecologi.com/softcreatr?r=61212ab3fc69b8eb8a2014f4"]}},"created_at":"2023-03-17T04:18:12.000Z","updated_at":"2025-04-25T06:37:50.000Z","dependencies_parsed_at":"2023-11-18T12:22:21.927Z","dependency_job_id":"433e9403-99cf-4510-af85-247929fc0500","html_url":"https://github.com/SoftCreatR/php-openai-sdk","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"792657aeeec1ddbf4d8129fe72828db7a073ff5d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftCreatR%2Fphp-openai-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftCreatR%2Fphp-openai-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftCreatR%2Fphp-openai-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SoftCreatR%2Fphp-openai-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SoftCreatR","download_url":"https://codeload.github.com/SoftCreatR/php-openai-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252892503,"owners_count":21820648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-wrapper","artificial-intelligence","dall-e","gpt","gpt-3","gpt-4","hacktoberfest","machine-learning","natural-language-processing","nlp","openai","php","php-library","sdk"],"created_at":"2024-10-03T19:13:10.390Z","updated_at":"2025-05-07T14:05:36.105Z","avatar_url":"https://github.com/SoftCreatR.png","language":"PHP","readme":"# OpenAI API Wrapper for PHP\n\n[![Build](https://img.shields.io/github/actions/workflow/status/SoftCreatR/php-openai-sdk/.github/workflows/create-release.yml?branch=main)](https://github.com/SoftCreatR/php-openai-sdk/actions/workflows/create-release.yml) [![Latest Release](https://img.shields.io/packagist/v/SoftCreatR/php-openai-sdk?color=blue\u0026label=Latest%20Release)](https://packagist.org/packages/softcreatr/php-openai-sdk) [![ISC licensed](https://img.shields.io/badge/license-ISC-blue.svg)](./LICENSE.md) [![Plant Tree](https://img.shields.io/badge/dynamic/json?color=brightgreen\u0026label=Plant%20Tree\u0026query=%24.total\u0026url=https%3A%2F%2Fpublic.ecologi.com%2Fusers%2Fsoftcreatr%2Ftrees)](https://ecologi.com/softcreatr?r=61212ab3fc69b8eb8a2014f4) [![Codecov branch](https://img.shields.io/codecov/c/github/SoftCreatR/php-openai-sdk)](https://codecov.io/gh/SoftCreatR/php-openai-sdk) [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability-percentage/SoftCreatR/php-openai-sdk)](https://codeclimate.com/github/SoftCreatR/php-openai-sdk)\n\nThis PHP library provides a simple wrapper for the OpenAI API, allowing you to easily integrate the OpenAI API into your PHP projects.\n\n## Features\n\n- Easy integration with OpenAI API\n- Supports all OpenAI API endpoints\n- Streaming support for real-time responses in chat completions\n- Utilizes PSR-17 and PSR-18 compliant HTTP clients and factories for making API requests\n\n## Requirements\n\n- PHP 8.1 or higher\n- A PSR-17 HTTP Factory implementation (e.g., [guzzle/psr7](https://github.com/guzzle/psr7) or [nyholm/psr7](https://github.com/Nyholm/psr7))\n- A PSR-18 HTTP Client implementation (e.g., [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) or [symfony/http-client](https://github.com/symfony/http-client))\n\n## Installation\n\nYou can install the library via [Composer](https://getcomposer.org/):\n\n```bash\ncomposer require softcreatr/php-openai-sdk\n```\n\n## Usage\n\nFirst, include the library in your project:\n\n```php\n\u003c?php\n\nrequire_once 'vendor/autoload.php';\n```\n\nThen, create an instance of the `OpenAI` class with your API key, organization (optional), an HTTP client, an HTTP request factory, and an HTTP stream factory:\n\n```php\nuse SoftCreatR\\OpenAI\\OpenAI;\n\n$apiKey = 'your_api_key';\n$organization = 'your_organization_id'; // optional\n\n// Replace these lines with your chosen PSR-17 and PSR-18 compatible HTTP client and factories\n$httpClient = new YourChosenHttpClient();\n$requestFactory = new YourChosenRequestFactory();\n$streamFactory = new YourChosenStreamFactory();\n$uriFactory = new YourChosenUriFactory();\n\n$openAI = new OpenAI($requestFactory, $streamFactory, $uriFactory, $httpClient, $apiKey, $organization);\n```\n\nNow you can call any supported OpenAI API endpoint using the magic method `__call`:\n\n```php\n$response = $openAI-\u003ecreateChatCompletion([\n    'model' =\u003e 'gpt-4',\n    'messages' =\u003e [\n        ['role' =\u003e 'system', 'content' =\u003e 'You are a helpful assistant.'],\n        ['role' =\u003e 'user', 'content' =\u003e 'Hello!'],\n    ],\n]);\n\n// Process the API response\nif ($response-\u003egetStatusCode() === 200) {\n    $responseObj = json_decode($response-\u003egetBody()-\u003egetContents(), true);\n\n    print_r($responseObj);\n} else {\n    echo \"Error: \" . $response-\u003egetStatusCode();\n}\n```\n\n### Streaming Example\n\nYou can enable real-time streaming for chat completions:\n\n```php\n$streamCallback = static function ($data) {\n    if (isset($data['choices'][0]['delta']['content'])) {\n        echo $data['choices'][0]['delta']['content'];\n    }\n};\n\n$openAI-\u003ecreateChatCompletion(\n    [\n        'model' =\u003e 'gpt-4',\n        'messages' =\u003e [\n            [\n                'role' =\u003e 'user',\n                'content' =\u003e 'Tell me a story about a brave knight.',\n            ],\n        ],\n        'stream' =\u003e true,\n    ],\n    $streamCallback\n);\n```\n\nFor more details on how to use each endpoint, refer to the [OpenAI API documentation](https://platform.openai.com/docs/api-reference), and the [examples](https://github.com/SoftCreatR/php-openai-sdk/tree/main/examples) provided in the repository.\n\n## Supported Methods\n\nBelow is a list of supported methods organized by category. Each method links to its corresponding OpenAI API documentation and includes a link to an example in this repository.\n\n### Audio\n\n- **Create Transcription** – [API Reference](https://platform.openai.com/docs/api-reference/audio/createTranscription) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/audio/createTranscription.php)  \n  `createTranscription(array $options = [])`\n- **Create Translation** – [API Reference](https://platform.openai.com/docs/api-reference/audio/createTranslation) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/audio/createTranslation.php)  \n  `createTranslation(array $options = [])`\n- **Create Speech** – [API Reference](https://platform.openai.com/docs/api-reference/audio/createSpeech) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/audio/createSpeech.php)  \n  `createSpeech(array $options = [])`\n\n### Responses\n\n- **Create Response** – [API Reference](https://platform.openai.com/docs/api-reference/responses/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/responses/createResponse.php)  \n  `createResponse(array $options = [], ?callable $streamCallback = null)`\n- **Get Response** – [API Reference](https://platform.openai.com/docs/api-reference/responses/get) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/responses/getResponse.php)  \n  `getResponse(array $parameters)`\n- **Delete Response** – [API Reference](https://platform.openai.com/docs/api-reference/responses/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/responses/deleteResponse.php)  \n  `deleteResponse(array $parameters)`\n- **List Input Items** – [API Reference](https://platform.openai.com/docs/api-reference/responses/input-items) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/responses/listInputItems.php)  \n  `listInputItems(array $parameters)`\n\n### Chat\n\n- **Create Chat Completion** – [API Reference](https://platform.openai.com/docs/api-reference/chat/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/chat/createChatCompletion.php)  \n  `createChatCompletion(array $options = [], ?callable $streamCallback = null)`\n- **Get Chat Completion** – [API Reference](https://platform.openai.com/docs/api-reference/chat/get) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/chat/getChatCompletion.php)  \n  `getChatCompletion(array $parameters)`\n- **Get Chat Messages** – [API Reference](https://platform.openai.com/docs/api-reference/chat/getMessages) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/chat/getChatMessages.php)  \n  `getChatMessages(array $parameters)`\n- **List Chat Completions** – [API Reference](https://platform.openai.com/docs/api-reference/chat/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/chat/listChatCompletions.php)  \n  `listChatCompletions(array $options = [])`\n- **Update Chat Completion** – [API Reference](https://platform.openai.com/docs/api-reference/chat/update) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/chat/updateChatCompletion.php)  \n  `updateChatCompletion(array $parameters, array $options = [])`\n- **Delete Chat Completion** – [API Reference](https://platform.openai.com/docs/api-reference/chat/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/chat/deleteChatCompletion.php)  \n  `deleteChatCompletion(array $parameters)`\n\n### Embeddings\n\n- **Create Embedding** – [API Reference](https://platform.openai.com/docs/api-reference/embeddings/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/embeddings/createEmbedding.php)  \n  `createEmbedding(array $options = [])`\n\n### Fine-tuning\n\n- **Create Fine-tuning Job** – [API Reference](https://platform.openai.com/docs/api-reference/fine-tuning/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/fine-tuning/createFineTuningJob.php)  \n  `createFineTuningJob(array $options = [])`\n- **List Fine-tuning Jobs** – [API Reference](https://platform.openai.com/docs/api-reference/fine-tuning/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/fine-tuning/listFineTuningJobs.php)  \n  `listFineTuningJobs(array $options = [])`\n- **List Fine-tuning Events** – [API Reference](https://platform.openai.com/docs/api-reference/fine-tuning/events) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/fine-tuning/listFineTuningEvents.php)  \n  `listFineTuningEvents(array $parameters, array $options = [])`\n- **List Fine-tuning Checkpoints** – [API Reference](https://platform.openai.com/docs/api-reference/fine-tuning/checkpoints) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/fine-tuning/listFineTuningCheckpoints.php)  \n  `listFineTuningCheckpoints(array $parameters, array $options = [])`\n- **Retrieve Fine-tuning Job** – [API Reference](https://platform.openai.com/docs/api-reference/fine-tuning/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/fine-tuning/retrieveFineTuningJob.php)  \n  `retrieveFineTuningJob(array $parameters)`\n- **Cancel Fine-tuning Job** – [API Reference](https://platform.openai.com/docs/api-reference/fine-tuning/cancel) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/fine-tuning/cancelFineTuning.php)  \n  `cancelFineTuning(array $parameters)`\n\n### Batch\n\n- **Create Batch** – [API Reference](https://platform.openai.com/docs/api-reference/batch/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/batch/createBatch.php)  \n  `createBatch(array $options = [])`\n- **Retrieve Batch** – [API Reference](https://platform.openai.com/docs/api-reference/batch/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/batch/retrieveBatch.php)  \n  `retrieveBatch(array $parameters)`\n- **Cancel Batch** – [API Reference](https://platform.openai.com/docs/api-reference/batch/cancel) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/batch/cancelBatch.php)  \n  `cancelBatch(array $parameters)`\n- **List Batches** – [API Reference](https://platform.openai.com/docs/api-reference/batch/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/batch/listBatches.php)  \n  `listBatches(array $options = [])`\n\n### Files\n\n- **Upload File** – [API Reference](https://platform.openai.com/docs/api-reference/files/upload) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/files/uploadFile.php)  \n  `uploadFile(array $options = [])`\n- **List Files** – [API Reference](https://platform.openai.com/docs/api-reference/files/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/files/listFiles.php)  \n  `listFiles()`\n- **Retrieve File** – [API Reference](https://platform.openai.com/docs/api-reference/files/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/files/retrieveFile.php)  \n  `retrieveFile(array $parameters)`\n- **Delete File** – [API Reference](https://platform.openai.com/docs/api-reference/files/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/files/deleteFile.php)  \n  `deleteFile(array $parameters)`\n- **Download File** – [API Reference](https://platform.openai.com/docs/api-reference/files/retrieve-content) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/files/retrieveFileContent.php)  \n  `retrieveFileContent(array $parameters)`\n\n### Uploads\n\n- **Create Upload** – [API Reference](https://platform.openai.com/docs/api-reference/uploads/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/uploads/createUpload.php)  \n  `createUpload(array $options = [])`\n- **Add Upload Part** – [API Reference](https://platform.openai.com/docs/api-reference/uploads/add-part) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/uploads/addUploadPart.php)  \n  `addUploadPart(array $parameters, array $options = [])`\n- **Complete Upload** – [API Reference](https://platform.openai.com/docs/api-reference/uploads/complete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/uploads/completeUpload.php)  \n  `completeUpload(array $parameters)`\n- **Cancel Upload** – [API Reference](https://platform.openai.com/docs/api-reference/uploads/cancel) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/uploads/cancelUpload.php)  \n  `cancelUpload(array $parameters)`\n\n### Images\n\n- **Create Image** – [API Reference](https://platform.openai.com/docs/api-reference/images/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/images/createImage.php)  \n  `createImage(array $options = [])`\n- **Create Image Edit** – [API Reference](https://platform.openai.com/docs/api-reference/images/create-edit) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/images/createImageEdit.php)  \n  `createImageEdit(array $options = [])`\n- **Create Image Variation** – [API Reference](https://platform.openai.com/docs/api-reference/images/create-variation) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/images/createImageVariation.php)  \n  `createImageVariation(array $options = [])`\n\n### Models\n\n- **List Models** – [API Reference](https://platform.openai.com/docs/api-reference/models/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/models/listModels.php)  \n  `listModels()`\n- **Retrieve Model** – [API Reference](https://platform.openai.com/docs/api-reference/models/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/models/retrieveModel.php)  \n  `retrieveModel(array $parameters)`\n- **Delete Model** – [API Reference](https://platform.openai.com/docs/api-reference/models/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/models/deleteModel.php)  \n  `deleteModel(array $parameters)`\n\n### Moderations\n\n- **Create Moderation** – [API Reference](https://platform.openai.com/docs/api-reference/moderations/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/moderations/createModeration.php)  \n  `createModeration(array $options = [])`\n\n### Assistants\n\n- **Create Assistant** – [API Reference](https://platform.openai.com/docs/api-reference/assistants/createAssistant) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/assistants/createAssistant.php)  \n  `createAssistant(array $options = [])`\n- **List Assistants** – [API Reference](https://platform.openai.com/docs/api-reference/assistants/listAssistants) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/assistants/listAssistants.php)  \n  `listAssistants()`\n- **Retrieve Assistant** – [API Reference](https://platform.openai.com/docs/api-reference/assistants/getAssistant) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/assistants/retrieveAssistant.php)  \n  `retrieveAssistant(array $parameters)`\n- **Modify Assistant** – [API Reference](https://platform.openai.com/docs/api-reference/assistants/modifyAssistant) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/assistants/modifyAssistant.php)  \n  `modifyAssistant(array $parameters, array $options = [])`\n- **Delete Assistant** – [API Reference](https://platform.openai.com/docs/api-reference/assistants/deleteAssistant) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/assistants/deleteAssistant.php)  \n  `deleteAssistant(array $parameters)`\n\n#### Threads\n\n- **Create Thread** – [API Reference](https://platform.openai.com/docs/api-reference/threads/createThread) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/threads/createThread.php)  \n  `createThread(array $options = [])`\n- **Retrieve Thread** – [API Reference](https://platform.openai.com/docs/api-reference/threads/getThread) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/threads/retrieveThread.php)  \n  `retrieveThread(array $parameters)`\n- **Modify Thread** – [API Reference](https://platform.openai.com/docs/api-reference/threads/modifyThread) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/threads/modifyThread.php)  \n  `modifyThread(array $parameters, array $options = [])`\n- **Delete Thread** – [API Reference](https://platform.openai.com/docs/api-reference/threads/deleteThread) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/threads/deleteThread.php)  \n  `deleteThread(array $parameters)`\n\n#### Messages\n\n- **Create Message** – [API Reference](https://platform.openai.com/docs/api-reference/messages/createMessage) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/messages/createMessage.php)  \n  `createMessage(array $parameters, array $options = [])`\n- **List Messages** – [API Reference](https://platform.openai.com/docs/api-reference/messages/listMessages) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/messages/listMessages.php)  \n  `listMessages(array $parameters)`\n- **Retrieve Message** – [API Reference](https://platform.openai.com/docs/api-reference/messages/getMessage) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/messages/retrieveMessage.php)  \n  `retrieveMessage(array $parameters)`\n- **Modify Message** – [API Reference](https://platform.openai.com/docs/api-reference/messages/modifyMessage) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/messages/modifyMessage.php)  \n  `modifyMessage(array $parameters, array $options = [])`\n- **Delete Message** – [API Reference](https://platform.openai.com/docs/api-reference/messages/deleteMessage) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/messages/deleteMessage.php)  \n  `deleteMessage(array $parameters)`\n\n#### Runs\n\n- **Create Run** – [API Reference](https://platform.openai.com/docs/api-reference/runs/createRun) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/runs/createRun.php)  \n  `createRun(array $parameters, array $options = [])`\n- **Create Thread and Run** – [API Reference](https://platform.openai.com/docs/api-reference/runs/createThreadAndRun) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/runs/createThreadAndRun.php)  \n  `createThreadAndRun(array $options = [])`\n- **List Runs** – [API Reference](https://platform.openai.com/docs/api-reference/runs/listRuns) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/runs/listRuns.php)  \n  `listRuns(array $parameters)`\n- **Retrieve Run** – [API Reference](https://platform.openai.com/docs/api-reference/runs/getRun) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/runs/retrieveRun.php)  \n  `retrieveRun(array $parameters)`\n- **Modify Run** – [API Reference](https://platform.openai.com/docs/api-reference/runs/modifyRun) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/runs/modifyRun.php)  \n  `modifyRun(array $parameters, array $options = [])`\n- **Submit Tool Outputs to Run** – [API Reference](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/runs/submitToolOutputsToRun.php)  \n  `submitToolOutputsToRun(array $parameters, array $options = [])`\n- **Cancel Run** – [API Reference](https://platform.openai.com/docs/api-reference/runs/cancelRun) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/runs/cancelRun.php)  \n  `cancelRun(array $parameters)`\n\n#### Run Steps\n\n- **List Run Steps** – [API Reference](https://platform.openai.com/docs/api-reference/run-steps/listRunSteps) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/run-steps/listRunSteps.php)  \n  `listRunSteps(array $parameters)`\n- **Retrieve Run Step** – [API Reference](https://platform.openai.com/docs/api-reference/run-steps/getRunStep) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/run-steps/retrieveRunStep.php)  \n  `retrieveRunStep(array $parameters)`\n\n### Vector Stores\n\n- **Create Vector Store** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-stores/createVectorStore.php)  \n  `createVectorStore(array $options = [])`\n- **List Vector Stores** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-stores/listVectorStores.php)  \n  `listVectorStores()`\n- **Retrieve Vector Store** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-stores/retrieveVectorStore.php)  \n  `retrieveVectorStore(array $parameters)`\n- **Modify Vector Store** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores/modify) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-stores/modifyVectorStore.php)  \n  `modifyVectorStore(array $parameters, array $options = [])`\n- **Delete Vector Store** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-stores/deleteVectorStore.php)  \n  `deleteVectorStore(array $parameters)`\n- **Search vector store** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores/search) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-stores/searchVectorStore.php)  \n  `deleteVectorStore(array $parameters)`\n\n#### Vector Store Files\n\n- **Create Vector Store File** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-files/createFile) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-files/createVectorStoreFile.php)  \n  `createVectorStoreFile(array $parameters, array $options = [])`\n- **List Vector Store Files** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-files/listFiles) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-files/listVectorStoreFiles.php)  \n  `listVectorStoreFiles(array $parameters)`\n- **Retrieve vector store file content** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-files/getContent) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-files/retrieveVectorStoreFileContent.php)  \n  `listVectorStoreFiles(array $parameters)`\n- **Update vector store file attributes** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-files/updateAttributes) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-files/updateVectorStoreFileAttributes.php)  \n  `listVectorStoreFiles(array $parameters)`\n- **Retrieve Vector Store File** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-files/getFile) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-files/retrieveVectorStoreFile.php)  \n  `retrieveVectorStoreFile(array $parameters)`\n- **Delete Vector Store File** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-files/deleteFile) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-files/deleteVectorStoreFile.php)  \n  `deleteVectorStoreFile(array $parameters)`\n\n#### Vector Store File Batches\n\n- **Create Vector Store File Batch** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-file-batches/createVectorStoreFileBatch.php)  \n  `createVectorStoreFileBatch(array $parameters, array $options = [])`\n- **Retrieve Vector Store File Batch** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/getBatch) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-file-batches/retrieveVectorStoreFileBatch.php)  \n  `retrieveVectorStoreFileBatch(array $parameters)`\n- **Cancel Vector Store File Batch** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/cancelBatch) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-file-batches/cancelVectorStoreFileBatch.php)  \n  `cancelVectorStoreFileBatch(array $parameters)`\n- **List Vector Store Files in Batch** – [API Reference](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/listBatchFiles) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/assistants/vector-store-file-batches/listVectorStoreFilesInBatch.php)  \n  `listVectorStoreFilesInBatch(array $parameters)`\n\n### Administration\n\n#### Invites\n\n- **List Invites** – [API Reference](https://platform.openai.com/docs/api-reference/invite/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/invites/listInvites.php)  \n  `listInvites()`\n- **Create Invite** – [API Reference](https://platform.openai.com/docs/api-reference/invite/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/invites/createInvite.php)  \n  `createInvite(array $options = [])`\n- **Retrieve Invite** – [API Reference](https://platform.openai.com/docs/api-reference/invite/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/invites/retrieveInvite.php)  \n  `retrieveInvite(array $parameters)`\n- **Delete Invite** – [API Reference](https://platform.openai.com/docs/api-reference/invite/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/invites/deleteInvite.php)  \n  `deleteInvite(array $parameters)`\n\n#### Users\n\n- **List Users** – [API Reference](https://platform.openai.com/docs/api-reference/org-users/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/org-users/listUsers.php)  \n  `listUsers()`\n- **Modify User** – [API Reference](https://platform.openai.com/docs/api-reference/org-users/modify) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/org-users/modifyUser.php)  \n  `modifyUser(array $parameters, array $options = [])`\n- **Retrieve User** – [API Reference](https://platform.openai.com/docs/api-reference/org-users/listget) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/org-users/retrieveUser.php)  \n  `retrieveUser(array $parameters)`\n- **Delete User** – [API Reference](https://platform.openai.com/docs/api-reference/org-users/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/org-users/deleteUser.php)  \n  `deleteUser(array $parameters)`\n\n#### Admin API Keys\n\n- **List Admin API Keys** – [API Reference](https://platform.openai.com/docs/api-reference/admin-api-keys/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/admin-api-keys/listAdminApiKeys.php)  \n  `listAdminApiKeys(array $options = [])`\n- **Create Admin API Key** – [API Reference](https://platform.openai.com/docs/api-reference/admin-api-keys/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/admin-api-keys/createAdminApiKey.php)  \n  `createAdminApiKey(array $options = [])`\n- **Retrieve Admin API Key** – [API Reference](https://platform.openai.com/docs/api-reference/admin-api-keys/listget) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/admin-api-keys/retrieveAdminApiKey.php)  \n  `retrieveAdminApiKey(array $parameters)`\n- **Delete Admin API Key** – [API Reference](https://platform.openai.com/docs/api-reference/admin-api-keys/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/admin-api-keys/deleteAdminApiKey.php)  \n  `deleteAdminApiKey(array $parameters)`\n\n#### Certificates\n\n- **Upload Certificate** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/uploadCertificate) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/uploadCertificate.php)  \n  `uploadCertificate(array $options = [])`\n- **List Certificates** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/listOrganizationCertificates) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/listCertificates.php)  \n  `listCertificates(array $options = [])`\n- **Get Certificate** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/getCertificate) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/getCertificate.php)  \n  `getCertificate(array $parameters)`\n- **Modify Certificate** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/modifyCertificate) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/modifyCertificate.php)  \n  `modifyCertificate(array $parameters, array $options = [])`\n- **Delete Certificate** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/deleteCertificate) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/deleteCertificate.php)  \n  `deleteCertificate(array $parameters)`\n- **List Project Certificates** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/listProjectCertificates) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/listProjectCertificates.php)  \n  `listProjectCertificates(array $parameters)`\n- **Activate Certificates** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/activateOrganizationCertificates) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/activateCertificates.php)  \n  `activateCertificates(array $options = [])`\n- **Deactivate Certificates** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/deactivateOrganizationCertificates) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/deactivateCertificates.php)  \n  `deactivateCertificates(array $options = [])`\n- **Activate Project Certificates** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/activateProjectCertificates) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/activateProjectCertificates.php)  \n  `activateProjectCertificates(array $parameters)`\n- **Deactivate Project Certificates** – [API Reference](https://platform.openai.com/docs/api-reference/certificates/deactivateProjectCertificates) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/certificates/deactivateProjectCertificates.php)  \n  `deactivateProjectCertificates(array $parameters)`\n\n#### Rate Limits\n\n- **List Project Rate Limits** – [API Reference](https://platform.openai.com/docs/api-reference/project-rate-limits/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/rate-limits/listProjectRateLimits.php)  \n  `listProjectRateLimits(array $parameters)`\n- **Modify Project Rate Limit** – [API Reference](https://platform.openai.com/docs/api-reference/project-rate-limits/update) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/rate-limits/modifyProjectRateLimit.php)  \n  `modifyProjectRateLimit(array $parameters, array $options = [])`\n\n#### Usage\n\n- **Get Completions Usage** – [API Reference](https://platform.openai.com/docs/api-reference/usage/completions) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/usage/getCompletionsUsage.php)  \n  `getCompletionsUsage(array $parameters = [])`\n- **Get Embeddings Usage** – [API Reference](https://platform.openai.com/docs/api-reference/usage/embeddings) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/usage/getEmbeddingsUsage.php)  \n  `getEmbeddingsUsage(array $parameters = [])`\n- **Get Moderations Usage** – [API Reference](https://platform.openai.com/docs/api-reference/usage/moderations) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/usage/getModerationsUsage.php)  \n  `getModerationsUsage(array $parameters = [])`\n- **Get Images Usage** – [API Reference](https://platform.openai.com/docs/api-reference/usage/images) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/usage/getImagesUsage.php)  \n  `getImagesUsage(array $parameters = [])`\n- **Get Audio Speeches Usage** – [API Reference](https://platform.openai.com/docs/api-reference/usage/audio_speeches) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/usage/getAudioSpeechesUsage.php)  \n  `getAudioSpeechesUsage(array $parameters = [])`\n- **Get Vector Stores Usage** – [API Reference](https://platform.openai.com/docs/api-reference/usage/vector_stores) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/usage/getVectorStoresUsage.php)  \n  `getVectorStoresUsage(array $parameters = [])`\n- **Get Costs** – [API Reference](https://platform.openai.com/docs/api-reference/usage/costs) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/usage/getCosts.php)  \n  `getCosts(array $parameters = [])`\n\n#### Projects\n\n- **List Projects** – [API Reference](https://platform.openai.com/docs/api-reference/projects/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/projects/listProjects.php)  \n  `listProjects()`\n- **Create Project** – [API Reference](https://platform.openai.com/docs/api-reference/projects/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/projects/createProject.php)  \n  `createProject(array $options = [])`\n- **Retrieve Project** – [API Reference](https://platform.openai.com/docs/api-reference/projects/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/projects/retrieveProject.php)  \n  `retrieveProject(array $parameters)`\n- **Modify Project** – [API Reference](https://platform.openai.com/docs/api-reference/projects/modify) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/projects/modifyProject.php)  \n  `modifyProject(array $parameters, array $options = [])`\n- **Archive Project** – [API Reference](https://platform.openai.com/docs/api-reference/projects/archive) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/projects/archiveProject.php)  \n  `archiveProject(array $parameters)`\n\n#### Project Users\n\n- **List Project Users** – [API Reference](https://platform.openai.com/docs/api-reference/project-users/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-users/listProjectUsers.php)  \n  `listProjectUsers(array $parameters)`\n- **Create Project User** – [API Reference](https://platform.openai.com/docs/api-reference/project-users/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-users/createProjectUser.php)  \n  `createProjectUser(array $parameters, array $options = [])`\n- **Retrieve Project User** – [API Reference](https://platform.openai.com/docs/api-reference/project-users/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-users/retrieveProjectUser.php)  \n  `retrieveProjectUser(array $parameters)`\n- **Modify Project User** – [API Reference](https://platform.openai.com/docs/api-reference/project-users/modify) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-users/modifyProjectUser.php)  \n  `modifyProjectUser(array $parameters, array $options = [])`\n- **Delete Project User** – [API Reference](https://platform.openai.com/docs/api-reference/project-users/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-users/deleteProjectUser.php)  \n  `deleteProjectUser(array $parameters)`\n\n#### Project Service Accounts\n\n- **List Project Service Accounts** – [API Reference](https://platform.openai.com/docs/api-reference/project-service-accounts/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-service-accounts/listProjectServiceAccounts.php)  \n  `listProjectServiceAccounts(array $parameters)`\n- **Create Project Service Account** – [API Reference](https://platform.openai.com/docs/api-reference/project-service-accounts/create) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-service-accounts/createProjectServiceAccount.php)  \n  `createProjectServiceAccount(array $parameters, array $options = [])`\n- **Retrieve Project Service Account** – [API Reference](https://platform.openai.com/docs/api-reference/project-service-accounts/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-service-accounts/retrieveProjectServiceAccount.php)  \n  `retrieveProjectServiceAccount(array $parameters)`\n- **Delete Project Service Account** – [API Reference](https://platform.openai.com/docs/api-reference/project-service-accounts/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-service-accounts/deleteProjectServiceAccount.php)  \n  `deleteProjectServiceAccount(array $parameters)`\n\n#### Project API Keys\n\n- **List Project API Keys** – [API Reference](https://platform.openai.com/docs/api-reference/project-api-keys/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-api-keys/listProjectApiKeys.php)  \n  `listProjectApiKeys(array $parameters)`\n- **Retrieve Project API Key** – [API Reference](https://platform.openai.com/docs/api-reference/project-api-keys/retrieve) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-api-keys/retrieveProjectApiKey.php)  \n  `retrieveProjectApiKey(array $parameters)`\n- **Delete Project API Key** – [API Reference](https://platform.openai.com/docs/api-reference/project-api-keys/delete) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/project-api-keys/deleteProjectApiKey.php)  \n  `deleteProjectApiKey(array $parameters)`\n\n#### Audit Logs\n\n- **List Audit Logs** – [API Reference](https://platform.openai.com/docs/api-reference/audit-logs/list) – [Example](https://github.com/SoftCreatR/php-openai-sdk/blob/main/examples/administration/audit-logs/listAuditLogs.php)  \n  `listAuditLogs(array $options = [])`\n\n## Changelog\n\nFor a detailed list of changes and updates, please refer to the [CHANGELOG.md](https://github.com/SoftCreatR/php-openai-sdk/blob/main/CHANGELOG.md) file. We adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and document notable changes for each release.\n\n## Known Problems and Limitations\n\n### Streaming Support\n\nStreaming is now supported for real-time token generation in chat completions. Please make sure you are handling streams correctly using a callback, as demonstrated in the examples.\n\n## License\n\nThis library is licensed under the ISC License. See the [LICENSE](https://github.com/SoftCreatR/php-openai-sdk/blob/main/LICENSE.md) file for more information.\n\n## Maintainers 🛠️\n\n\u003ctable\u003e\n\u003ctr\u003e\n    \u003ctd style=\"text-align:center;word-wrap:break-word;width:150px;height: 150px\"\u003e\n        \u003ca href=https://github.com/SoftCreatR\u003e\n            \u003cimg src=https://avatars.githubusercontent.com/u/81188?v=4 width=\"100;\" alt=\"Sascha Greuel\"/\u003e\n            \u003cbr /\u003e\n            \u003csub style=\"font-size:14px\"\u003e\u003cb\u003eSascha Greuel\u003c/b\u003e\u003c/sub\u003e\n        \u003c/a\u003e\n    \u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Contributors ✨\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n","funding_links":["https://github.com/sponsors/softcreatr","https://ecologi.com/softcreatr?r=61212ab3fc69b8eb8a2014f4"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftcreatr%2Fphp-openai-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftcreatr%2Fphp-openai-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftcreatr%2Fphp-openai-sdk/lists"}