{"id":26338929,"url":"https://github.com/assistantengine/php-openai-client","last_synced_at":"2025-06-16T12:32:36.893Z","repository":{"id":282059988,"uuid":"947344944","full_name":"AssistantEngine/php-openai-client","owner":"AssistantEngine","description":"Experimental PHP client for OpenAI’s new Responses API","archived":false,"fork":false,"pushed_at":"2025-06-12T09:22:59.000Z","size":676,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-12T09:45:28.953Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AssistantEngine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"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}},"created_at":"2025-03-12T14:41:04.000Z","updated_at":"2025-06-12T09:18:11.000Z","dependencies_parsed_at":"2025-03-12T15:51:21.710Z","dependency_job_id":"073effdb-6f80-45c6-83bb-5d056121be7c","html_url":"https://github.com/AssistantEngine/php-openai-client","commit_stats":null,"previous_names":["assistantengine/php-openai-client"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/AssistantEngine/php-openai-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Fphp-openai-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Fphp-openai-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Fphp-openai-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Fphp-openai-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AssistantEngine","download_url":"https://codeload.github.com/AssistantEngine/php-openai-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Fphp-openai-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260162187,"owners_count":22967997,"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":[],"created_at":"2025-03-16T03:15:45.739Z","updated_at":"2025-06-16T12:32:36.836Z","avatar_url":"https://github.com/AssistantEngine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![Hero](media/hero.png)\n\n\u003c/div\u003e\n\n\n# Experimental PHP OpenAI Responses Client\n\nThis is an **experimental** PHP client for the new **OpenAI Responses API**. It implements the `create`, `find`, `delete` and `list input items` methods from the API, returning mapped response objects for seamless integration.\n\nThe goal of this experimental client is to provide a quick, easy-to-use library that allows you to experiment with the new endpoints from early on.\n\n## Installation\nInstall the package via Composer:\n\n```bash\ncomposer require assistant-engine/php-openai-client\n```\n\n## Usage\n\n### Conversation State\n\n```php\nuse AssistantEngine\\OpenAI\\Client;\n\n$client = Client::make($_ENV['OPEN_AI_KEY']);\n\n$response = $client-\u003eresponses()-\u003ecreate([\n    'model' =\u003e 'gpt-4o',\n    'input' =\u003e \"Can you recommend me what I can eat today?\"\n]);\n\nprint_r($response-\u003egetOutputText());\n\n$response2 = $client-\u003eresponses()-\u003ecreate([\n    'model' =\u003e 'gpt-4o',\n    'previous_response_id' =\u003e $response-\u003eid,\n    'input' =\u003e \"maybe Pizza?\",\n]);\n\nprint_r($response2-\u003egetOutputText());\n\n```\n\n### File Search\n\n```php\nuse AssistantEngine\\OpenAI\\Client;\n\n$client = Client::make($_ENV['OPEN_AI_KEY']);\n\n$response = $client-\u003eresponses()-\u003ecreate([\n    'model' =\u003e 'gpt-4o',\n    'tools' =\u003e [\n        [\n            'type' =\u003e 'file_search',\n            \"vector_store_ids\" =\u003e [\"vs_123456789\"]\n        ]\n    ],\n    'input' =\u003e \"when is the event in berlin happening?\"\n]);\n\nprint_r($response-\u003egetOutputText());\n```\n\n### Web Search\n\n```php\nuse AssistantEngine\\OpenAI\\Client;\n\n$client = Client::make($_ENV['OPEN_AI_KEY']);\n\n$response = $client-\u003eresponses()-\u003ecreate([\n    'model' =\u003e 'gpt-4o',\n    'tools' =\u003e [\n        [\n            'type' =\u003e 'web_search_preview'\n        ]\n    ],\n    'input' =\u003e \"what was a positive news story from today?\"\n]);\n\nprint_r($response-\u003egetOutputText());\n```\n\n### Computer Use\n\n```php\nuse AssistantEngine\\OpenAI\\Client;\n\n$client = Client::make($_ENV['OPEN_AI_KEY']);\n\n// Path to your image file\n$imageFilePath = './path/to/browser_screenshot.png';\n\n// Read the image file contents\n$imageData = file_get_contents($imageFilePath);\n\n// Base64 encode the image data\n$base64Image = base64_encode($imageData);\n\n$response = $client-\u003eresponses()-\u003ecreate([\n    'model' =\u003e 'computer-use-preview',\n    'tools' =\u003e [\n        [\n            'type' =\u003e 'computer_use_preview',\n            \"display_width\" =\u003e 1024,\n            \"display_height\" =\u003e 768,\n            \"environment\" =\u003e \"browser\"\n        ]\n    ],\n    'input' =\u003e [\n        [\n            \"role\" =\u003e \"user\",\n            \"content\" =\u003e [\n                [\n                    \"type\" =\u003e \"input_text\",\n                    \"text\" =\u003e \"Can you find me products in sale?\"\n                ],\n                [\n                    \"type\" =\u003e \"input_image\",\n                    \"image_url\" =\u003e \"data:image/png;base64,\" . $base64Image\n                ]\n            ]\n        ],\n\n    ],\n    \"truncation\" =\u003e \"auto\"\n]);\n\nprint_r($response);\n```\n### List input items\n\n```php\nuse AssistantEngine\\OpenAI\\Client;\n\n$client = Client::make($_ENV['OPEN_AI_KEY']);\n// Define query parameters for pagination and ordering\n$params = [\n    'after'  =\u003e 'item-id-to-start-after',  // Optional: list items after this ID\n    'limit'  =\u003e 50,                        // Optional: limit number of items (default is 20)\n    'order'  =\u003e 'desc',                    // Optional: order items in descending order\n];\n\n$respId = \"resp_123456789\";\n$list = $client-\u003eresponses()-\u003einputItems()-\u003elist($respId, $params);\n\nprint_r($list);\n```\n\nPlease note that this is an experimental client with the purpose to give you a fast possibility to explore the new OpenAI responses API with PHP. Please expect bugs and that not every feature from the new API is implemented.\n\n## More Repositories\n\nWe’ve created more repositories to make AI integration even simpler and more powerful! Check them out:\n\n- **[Open Functions Core](https://github.com/AssistantEngine/open-functions-core)**: Powerful primitives that simplify LLM calling and ready-to-use integrations for popular platforms such as Slack, GitHub, Bitbucket, Trello, and Jira Service Desk.\n- **[Filament Assistant](https://github.com/AssistantEngine/filament-assistant)**: Add conversational AI capabilities directly into Laravel Filament.\n\n\u003e We are a young startup aiming to make it easy for developers to add AI to their applications. We welcome feedback, questions, comments, and contributions. Feel free to contact us at [contact@assistant-engine.com](mailto:contact@assistant-engine.com).\n\n\n## Consultancy \u0026 Support\n\nDo you need assistance integrating AI into your PHP applications, or help setting it up?  \nWe offer consultancy services to help you get the most out of our packages, whether you’re just getting started or looking to optimize an existing setup.\n\nReach out to us at [contact@assistant-engine.com](mailto:contact@assistant-engine.com).\n\n## Contributing\n\nWe welcome contributions from the community! Feel free to submit pull requests, open issues, and help us improve the package.\n\n## License\n\nThis project is licensed under the MIT License. Please see [License File](LICENSE.md) for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassistantengine%2Fphp-openai-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassistantengine%2Fphp-openai-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassistantengine%2Fphp-openai-client/lists"}