aisdk / togetherai
Official TogetherAI provider for the PHP AI SDK.
Fund package maintenance!
v0.8.0
2026-07-15 12:24 UTC
Requires
- php: ^8.3
- aisdk/core: ^0.8.0
- aisdk/openai-compatible: ^0.8.0
Requires (Dev)
- laravel/pint: ^1.18
- nyholm/psr7: ^1.8
- pestphp/pest: ^3.0 || ^4.0
- phpstan/phpstan: ^2.0
- rector/rector: ^2.0
README
Official TogetherAI provider for the PHP AI SDK. Uses TogetherAI's Chat Completions API.
Installation
composer require aisdk/togetherai
Basic Usage
use AiSdk\Generate; use AiSdk\TogetherAI; $result = Generate::text('What happened in technology today?') ->model(TogetherAI::model('meta-llama/Llama-3.3-70B-Instruct-Turbo')) ->run(); echo $result->text;
Configuration
| Variable | Description | Default |
|---|---|---|
TOGETHERAI_API_KEY |
API key for authentication | Required |
TOGETHERAI_BASE_URL |
Base URL for API requests | https://api.togetherai.ai |
Supported Capabilities
| Capability | Support |
|---|---|
| Text generation | Native |
| Streaming | Native |
| Tool calling | Native |
| Structured output | Adapted (json_object with an explicit JSON instruction) |
| Text input | Native |
Provider-specific fields can be passed through providerOptions('togetherai', [...]). Model IDs are opaque strings and TogetherAI remains the authority on model availability.
Testing
composer test:all
Documentation
Community
- Contributing
- Support
- For private security reports, email security@phpaisdk.com.