Download the PHP package r5dy1n/straico-php without Composer
On this page you can find all versions of the php package r5dy1n/straico-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package straico-php
Straico PHP SDK
A comprehensive PHP SDK for the Straico API - a unified platform for generative AI capabilities including text generation, image creation, chat, RAG (Retrieval Augmented Generation), and autonomous agents.
Features
- Simple and intuitive API interface
- Support for all Straico API endpoints (v0, v1, v2)
- Environment variable configuration
- PSR-4 autoloading
- Comprehensive error handling
- Full type hinting
- File upload support
- Multi-version API support
Requirements
- PHP 7.4 or higher
- Composer
Installation
Install via Composer:
Configuration
API Key
Get your API key from Straico. You can provide it in two ways:
-
Environment Variable (recommended):
- Constructor Parameter:
Usage
Initialize Client
User Information
Get current user account details including coins, plan, and name:
Available Models
Retrieve list of available AI models with pricing and specifications:
Get Specific Model
Get detailed information about a specific model:
Prompt Completion (Text Generation)
Generate text using AI models:
With Additional Options
With YouTube URL Analysis
Chat Completion
Use chat-based models with conversation history:
File Upload
Upload files to use in other API calls:
Image Generation
Generate images from text descriptions:
RAG (Retrieval Augmented Generation)
Create RAG Instance
List All RAGs
Get Specific RAG
Update RAG with New Files
Add more files to an existing RAG:
Query RAG with Prompt
Delete RAG
Agents
Create Agent
Create autonomous agents for task execution:
Query Agent
Error Handling
All methods throw StraicoException on errors:
API Methods Reference
User
| Method | Description | Version |
|---|---|---|
user() |
Get user account information | v0 |
Models
| Method | Description | Version |
|---|---|---|
models() |
List available AI models | v0 |
modelsV1() |
List available AI models | v1 |
modelsV2() |
List available AI models (OpenAI-compatible) | v2 |
model($modelId) |
Get specific model information | v2 |
Prompt Completion
| Method | Description | Version |
|---|---|---|
promptCompletion($model, $message, $options) |
Generate text completion | v0 |
promptCompletionV1($model, $message, $options) |
Generate text completion | v1 |
Chat Completion
| Method | Description | Version |
|---|---|---|
chatCompletion($model, $messages, $options) |
Chat-based completion | v0 |
chatCompletionV1($model, $messages, $options) |
Chat-based completion | v1 |
chatCompletionV2($model, $messages, $options) |
Chat-based completion | v2 |
Files
| Method | Description | Version |
|---|---|---|
uploadFile($filePath) |
Upload a file | v0 |
Images
| Method | Description | Version |
|---|---|---|
imageGeneration($model, $description, $size, $variations) |
Generate images | v0 |
RAG
| Method | Description | Version |
|---|---|---|
createRag($name, $description, $files) |
Create RAG instance | v0 |
rags() |
List all RAGs | v0 |
rag($ragId) |
Get specific RAG | v0 |
updateRag($ragId, $filePaths) |
Update RAG with new files | v0 |
deleteRag($ragId) |
Delete RAG | v0 |
ragPromptCompletion($ragId, $model, $prompt, $options) |
Query RAG | v0 |
Agents
| Method | Description | Version |
|---|---|---|
createAgent($config) |
Create agent | v0 |
agentPromptCompletion($agentId, $prompt, $options) |
Query agent | v0 |
Official Documentation
For complete API documentation, visit:
License
MIT License
Support
For issues and questions:
- GitHub Issues: Create an issue
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.