Download the PHP package sabioweb/api-chatgpt without Composer
On this page you can find all versions of the php package sabioweb/api-chatgpt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sabioweb/api-chatgpt
More information about sabioweb/api-chatgpt
Files in sabioweb/api-chatgpt
Package api-chatgpt
Short Description A pure PHP OOP multi-model ChatGPT integration package supporting OCR, Mathematics, Programming, Chat Bot, and Speech models
License GPL-3.0-or-later
Informations about the package api-chatgpt
ChatGPT Multi-Model Package
A pure PHP OOP multi-model ChatGPT integration package supporting OCR, Mathematics, Programming, Chat Bot, and Speech models. This package is framework-agnostic, Composer-installable, and can be used in both standalone PHP projects and Laravel applications.
📖 Read in Persian / خواندن به فارسی
Features
- OCR Model: Extract text from images using ChatGPT Vision API
- Mathematics Model: Solve mathematical problems and equations
- Programming Model: Code generation, analysis, and debugging assistance
- Chat Bot Model: Conversational AI interactions
- Speech Model: Speech-to-Text (audio transcription) and Text-to-Speech (audio synthesis)
- Framework-agnostic: Works in Laravel, Symfony, or standalone PHP
- Composer-installable: PSR-4 autoloading support
- Comprehensive error handling: Custom exceptions for different error scenarios
Requirements
- PHP 8.1 or higher
- Composer
- ChatGPT API key
Installation
Or add to your composer.json:
Usage
Basic Setup
OCR Model
Extract text from images:
Mathematics Model
Solve mathematical problems:
Programming Model
Generate, analyze, and debug code:
Chat Bot Model
Conversational AI interactions:
Speech Model
Speech-to-Text and Text-to-Speech conversion:
Error Handling
The package provides custom exceptions for different error scenarios:
Configuration Options
OCR Configuration
model: ChatGPT model to use (default:gpt-4-vision-preview)quality: Image quality setting (default:high)maxTokens: Maximum tokens for response (default:300)
Mathematics Configuration
model: ChatGPT model to use (default:gpt-4)temperature: Temperature parameter 0.0-2.0 (default:0.3)maxTokens: Maximum tokens for response (default:1000)
Programming Configuration
model: ChatGPT model to use (default:gpt-4)temperature: Temperature parameter 0.0-2.0 (default:0.2)maxTokens: Maximum tokens for response (default:2000)defaultLanguage: Default programming language (optional)codeStyle: Code style preferences (optional)
Chat Bot Configuration
model: ChatGPT model to use (default:gpt-4)temperature: Temperature parameter 0.0-2.0 (default:0.7)maxTokens: Maximum tokens for response (default:1000)systemPrompt: System prompt for the chat bot (optional)maxHistory: Maximum number of messages in history (default:20)
Speech Configuration
Speech-to-Text Options:
sttModel: Whisper model to use (default:whisper-1)sttLanguage: Language hint (optional, e.g.,en,fa,de)sttResponseFormat: Response format (default:json)sttTemperature: Temperature parameter 0.0-1.0 (default:0.0)
Text-to-Speech Options:
ttsModel: TTS model to use (default:tts-1)ttsVoice: Voice selection -alloy,echo,fable,onyx,nova,shimmer(default:alloy)ttsSpeed: Speed multiplier 0.25-4.0 (default:1.0)ttsFormat: Output format -mp3,opus,aac,flac(default:mp3)
Supported Image Formats
- JPEG/JPG
- PNG
- GIF
- WebP
Maximum image size: 20MB
Supported Audio Formats
Speech-to-Text Input Formats:
- MP3
- WAV
- M4A
- MP4
- MPEG
- MPGA
- WebM
Maximum audio file size: 25MB
Text-to-Speech Output Formats:
- MP3
- Opus
- AAC
- FLAC
Text-to-Speech Voices:
alloy- Neutral, balanced voiceecho- Clear, articulate voicefable- Warm, expressive voiceonyx- Deep, authoritative voicenova- Bright, energetic voiceshimmer- Soft, gentle voice
API Requirements
- Valid ChatGPT API key
- API endpoint:
https://api.openai.com/v1/ - Rate limits: Subject to OpenAI's rate limiting policies
License
GPL-3.0-or-later
Contributing
Contributions are welcome! Please ensure all code follows PSR-12 standards and includes appropriate tests.
Support
For issues and questions, please open an issue on the project repository.