{"id":29872423,"url":"https://github.com/sysborg/chatgpt","last_synced_at":"2026-01-20T16:32:58.176Z","repository":{"id":306952334,"uuid":"1027832421","full_name":"sysborg/chatgpt","owner":"sysborg","description":"Simple and effective integration between Laravel and ChatGPT.","archived":false,"fork":false,"pushed_at":"2025-07-29T02:13:01.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-25T05:23:35.488Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/sysborg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-07-28T15:45:48.000Z","updated_at":"2025-08-17T04:21:26.000Z","dependencies_parsed_at":"2025-07-28T17:30:27.971Z","dependency_job_id":"0dc8cd4d-ba9d-4a07-97d6-984ca609fa05","html_url":"https://github.com/sysborg/chatgpt","commit_stats":null,"previous_names":["sysborg/chatgpt"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sysborg/chatgpt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fchatgpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fchatgpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fchatgpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fchatgpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysborg","download_url":"https://codeload.github.com/sysborg/chatgpt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fchatgpt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07-30T20:34:42.182Z","updated_at":"2026-01-20T16:32:58.163Z","avatar_url":"https://github.com/sysborg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sysborg ChatGPT Laravel Package\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/sysborg/chatgpt?style=flat-square)](https://packagist.org/packages/sysborg/chatgpt)\n[![Total Downloads](https://img.shields.io/packagist/dt/sysborg/chatgpt?style=flat-square)](https://packagist.org/packages/sysborg/chatgpt)\n[![License: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n![Laravel](https://img.shields.io/badge/laravel-10%2B-red?style=flat-square\\\u0026logo=laravel)\n![PHP](https://img.shields.io/badge/php-%5E8.1-blue?style=flat-square\\\u0026logo=php)\n![Composer](https://img.shields.io/badge/ready%20for-composer-8952a8?style=flat-square\\\u0026logo=composer)\n\nA simple and effective integration between Laravel and ChatGPT. This package provides a clean, developer-friendly interface for interacting with the OpenAI API, including support for chat, text completions, and image analysis with GPT-4 Vision.\n\n---\n\n## Features\n\n* ✅ **Chat Completions** – Conversational AI with memory\n* ✅ **Text Completions** – Continue or generate texts\n* ✅ **Vision Analysis** – Image understanding with GPT-4 Vision\n* ✅ **Rate Limiting** – Configurable request throttling\n* ✅ **Retry Logic** – Automatic retries on failures\n* ✅ **Multiple Models** – GPT-3.5, GPT-4, and GPT-4 Vision supported\n* ✅ **Laravel Integration** – Includes Service Provider and Facade\n* ✅ **Auto Discovery** – Automatically registered in Laravel\n\n---\n\n## Installation\n\nInstall the package via Composer:\n\n```bash\ncomposer require sysborg/chatgpt\n```\n\n### Publish Configuration\n\nTo publish the config file:\n\n```bash\nphp artisan vendor:publish --tag=chatgpt-config\n```\n\n### Set Your API Key\n\nAdd your OpenAI API key in the `.env` file:\n\n```env\nOPENAI_API_KEY=your_openai_api_key_here\n```\n\n---\n\n## Configuration\n\nCustomize `config/chatgpt.php` to match your needs:\n\n```php\nreturn [\n    'api_key' =\u003e env('OPENAI_API_KEY'),\n    'base_url' =\u003e env('OPENAI_BASE_URL', 'https://api.openai.com/v1'),\n    'default_model' =\u003e env('OPENAI_DEFAULT_MODEL', 'gpt-3.5-turbo'),\n    'timeout' =\u003e env('OPENAI_TIMEOUT', 60),\n    'max_tokens' =\u003e env('OPENAI_MAX_TOKENS', 1000),\n    'temperature' =\u003e env('OPENAI_TEMPERATURE', 0.7),\n    'retry_attempts' =\u003e env('OPENAI_RETRY_ATTEMPTS', 2),\n    'retry_delay' =\u003e env('OPENAI_RETRY_DELAY', 1),\n    'rate_limit' =\u003e env('OPENAI_RATE_LIMIT', 60), // 0 = unlimited\n];\n```\n\n---\n\n## Basic Usage\n\n### Simple Chat\n\n```php\nuse Sysborg\\ChatGPT\\Facades\\ChatGPT;\n\n$response = ChatGPT::chat('Hello, how are you?');\necho $response-\u003egetContent();\n```\n\n### Chat With History\n\n```php\n$messages = [\n    ['role' =\u003e 'user', 'content' =\u003e 'What is the capital of Brazil?'],\n    ['role' =\u003e 'assistant', 'content' =\u003e 'The capital of Brazil is Brasília.'],\n    ['role' =\u003e 'user', 'content' =\u003e 'What is the population?']\n];\n\n$response = ChatGPT::chatWithHistory($messages);\necho $response-\u003egetContent();\n```\n\n### Text Completion\n\n```php\n$response = ChatGPT::completion('Once upon a time in a distant kingdom');\necho $response-\u003egetContent();\n```\n\n### Image Analysis\n\n```php\n$response = ChatGPT::vision(\n    'https://example.com/image.jpg',\n    'Describe this image in detail'\n);\n\n// With base64 image\n$base64 = base64_encode(file_get_contents('/path/to/image.jpg'));\n$response = ChatGPT::visionFromBase64(\n    $base64,\n    'What do you see in this image?'\n);\n\necho $response-\u003egetAnalysis();\n```\n\n---\n\n## Dynamic Configuration\n\n```php\n$response = ChatGPT::setModel('gpt-4')\n    -\u003esetTemperature(0.9)\n    -\u003esetMaxTokens(2000)\n    -\u003echat('Tell a creative story');\n```\n\n---\n\n## Handling Responses\n\n### Chat Response\n\n```php\n$response = ChatGPT::chat('Hi!');\n\necho $response-\u003egetContent();\necho $response-\u003egetModel();\necho $response-\u003egetTotalTokens();\necho $response-\u003egetFinishReason();\n\nif ($response-\u003eisComplete()) {\n    echo \"Completed successfully\";\n}\n\nif ($response-\u003eisTruncated()) {\n    echo \"Response was truncated\";\n}\n```\n\n### Vision Response\n\n```php\n$response = ChatGPT::vision($imageUrl, 'Analyze this image');\n\necho $response-\u003egetAnalysis();\nprint_r($response-\u003egetDetectedEntities());\necho $response-\u003egetSummary();\n\nif ($response-\u003ehasSafetyConcerns()) {\n    echo \"This image may contain sensitive content\";\n}\n```\n\n---\n\n## Error Handling\n\n```php\nuse Sysborg\\ChatGPT\\Exceptions\\ChatGPTException;\nuse Sysborg\\ChatGPT\\Exceptions\\RateLimitException;\n\ntry {\n    $response = ChatGPT::chat('Hi!');\n} catch (RateLimitException $e) {\n    echo \"Rate limit exceeded. Retry in: \" . $e-\u003egetRetryAfter() . \" seconds\";\n} catch (ChatGPTException $e) {\n    echo \"API error: \" . $e-\u003egetMessage();\n    print_r($e-\u003egetContext());\n}\n```\n\n---\n\n## Rate Limiting\n\nBuilt-in rate limit handling:\n\n```php\n$status = ChatGPT::getRateLimitStatus();\necho \"Requests remaining: \" . $status['remaining'];\n\nChatGPT::resetRateLimit(); // Useful for testing\n```\n\n---\n\n## Available Models\n\n```php\n$models = ChatGPT::getAvailableModels();\nprint_r($models);\n```\n\n**Example Output:**\n\n```php\n[\n    'gpt-3.5-turbo',\n    'gpt-3.5-turbo-16k',\n    'gpt-4',\n    'gpt-4-turbo',\n    'gpt-4-vision-preview',\n    'gpt-4-32k'\n]\n```\n\n---\n\n## Advanced Examples\n\n### Chat with Custom Config\n\n```php\n$response = ChatGPT::chatWithHistory([\n    ['role' =\u003e 'system', 'content' =\u003e 'You are a programming assistant.'],\n    ['role' =\u003e 'user', 'content' =\u003e 'How do I create a REST API in Laravel?']\n], [\n    'model' =\u003e 'gpt-4',\n    'temperature' =\u003e 0.3,\n    'max_tokens' =\u003e 1500,\n    'top_p' =\u003e 0.9\n]);\n```\n\n### Vision Analysis with Settings\n\n```php\n$response = ChatGPT::vision($imageUrl, 'Analyze this image', [\n    'model' =\u003e 'gpt-4-vision-preview',\n    'detail' =\u003e 'high', // Options: low, high, auto\n    'max_tokens' =\u003e 1000\n]);\n```\n\n---\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n---\n\n## License\n\nThis package is licensed under the [MIT License](LICENSE.md).\n\n---\n\n## Author\n\n**Anderson Arruda**\n📧 [andmarruda@gmail.com](mailto:andmarruda@gmail.com)\n🐙 [@andmarruda on GitHub](https://github.com/andmarruda)\n\n---\n\n## Support\n\nIf you encounter any issues or have questions, please open a [GitHub Issue](https://github.com/sysborg/chatgpt/issues).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysborg%2Fchatgpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysborg%2Fchatgpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysborg%2Fchatgpt/lists"}