Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Groq Php Laravel Package

lucianotonet/groq-php

A PHP SDK for the GroqCloud API that lets developers add fast LLM inference to any PHP app, with chat completions, tool calling, vision, reasoning, audio transcription, text-to-speech, batch processing, and RAG support.

View on GitHub
Deep Wiki
Context7
v1.4.2

Fixed / Added (v1.4.2)

  • Documents (RAG) & Citations restored: re-added the documents and citation_options Chat Completions parameters as pass-through forwarding, plus BuiltInTools::document() and BuiltInTools::documentFromFile() helpers. These are valid API parameters; support is model-specific (the legacy RAG models llama-3.3-70b-versatile / llama-3.1-8b-instant were retired on 2026-08-16 for free/developer tiers, so current models reject documents with not supported with this model). The library forwards them as-is and lets the API enforce model support.
  • Chat Completions parity: added the disable_tool_validation parameter pass-through.
  • Audio transcription/translation parity: added the url parameter (alternative to file) and fixed timestamp_granularities[] so each granularity is sent as a repeated multipart field (previously sent as a single array, which the API rejected). Both endpoints now accept either file or url.

See the CHANGELOG for details.

v1.4.1

Patch correcting API contract mismatches found during live validation of v1.4.0.

Fixed

  • Built-in Tools / Compound: use the current Compound system models (compound-beta / compound-beta-mini) instead of the deprecated groq/compound alias.
  • Removed the documents (RAG) and citation_options Chat Completions parameters: the live Groq API rejects them on all current models, so they were non-functional. compound_custom and search_settings remain.
  • New tests (BuiltInToolsTest, ResponsesTest) are now mode-aware so they pass against both the offline mock (default) and the real API (GROQ_LIVE_TESTS=1).

Full diff: https://github.com/lucianotonet/groq-php/compare/v1.4.0...v1.4.1

v1.4.0

Added

  • Responses API client (Groq::responses()): OpenAI-compatible input/output model responses with streaming, structured outputs (text.format), and reasoning controls.
  • Built-in tools & Compound: LucianoTonet\GroqPHP\BuiltInTools helpers for compound_custom, plus documents, search_settings, and citation_options on Chat Completions (RAG & citations).
  • TTS parameters: Speech::sampleRate() and Speech::speed() fluent setters forwarded to the audio/speech endpoint.
  • Transcriptions: timestamp_granularities[] is now forwarded (Groq supports it with response_format=verbose_json).
  • Docs: Prompt Caching & Content Moderation (safeguard models).
  • Offline mock test layer (tests/MockRouter) so the suite runs with zero network/API credits; CI runs mocked by default with a nightly live job.

Changed

  • Documentation refreshed and verified against console.groq.com/docs (model defaults, Vision, Reasoning, deprecated models, features).

Fixed

  • Transcriptions docblock incorrectly claimed timestamp_granularities[] was unsupported.

Full diff: https://github.com/lucianotonet/groq-php/compare/v1.3.0...v1.4.0

v1.3.0

🚀 Release v1.3.0

This release brings significant improvements to the Files/Batches module, including expanded support for batch processing of chat completions and audio operations.

🔄 Breaking Changes in Files/Batches Module

New JSONL Format Requirements (Fixes #14)

  • Each line must now follow Groq's official batch format:
    {
      "custom_id": "your-tracking-id",
      "method": "POST",
      "url": "/v1/chat/completions",
      "body": {
        "model": "llama-3.1-8b-instant",
        "messages": [...]
      }
    }
    

File Restrictions

  • Only .jsonl extension is now supported
  • Removed support for .json, .txt, .ndjson

✨ New Features

  • Batch processing support for:
    • Chat completions
    • Audio transcription
    • Audio translation
  • Enhanced validation and error handling

🛠️ Improvements

  • Additional MIME types support
  • Better JSONL file type detection
  • Expanded test coverage
  • Updated documentation

📝 Migration Guide

  1. Update your JSONL files:

    • Add custom_id field
    • Set method to "POST"
    • Use proper endpoint URL
    • Move request parameters inside body object
  2. Supported Endpoints:

    • /v1/chat/completions
    • /v1/audio/transcriptions
    • /v1/audio/translations

📚 Example JSONL File

{"custom_id": "chat-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "llama-3.1-8b-instant", "messages": [{"role": "user", "content": "Hello"}]}}
{"custom_id": "audio-1", "method": "POST", "url": "/v1/audio/transcriptions", "body": {"model": "whisper-large-v3", "language": "en", "url": "https://example.com/audio.wav"}}

📋 Notes

  • Changes only affect the Files/Batches module
  • Core library features remain unchanged
  • All tests passing: 39 tests, 218 assertions

🔗 Links

v1.1.0

Release Notes: v1.1.0

New features

Text-to-Speech (TTS) API Integration

  • Added support for GroqCloud's Text-to-Speech API
  • Implemented the Speech class with a fluent interface for easy configuration
  • Added a new speech() method to the Audio class
  • Added support for both English and Arabic TTS models

Implementation details

  • Models: Added support for playai-tts (English) and playai-tts-arabic (Arabic)
  • Parameters:
    • model(): Set the TTS model to use
    • input(): Define text to convert to speech
    • voice(): Set voice identifier (e.g., "Bryan-PlayAI")
    • responseFormat(): Define output format (default: "wav")
  • Methods:
    • create(): Returns audio content as stream
    • save($filePath): Saves audio directly to a file

Example usage

// Save audio to file
$result = $groq->audio()->speech()
    ->model('playai-tts')
    ->input('Hello, this text will be converted to speech')
    ->voice('Bryan-PlayAI')
    ->responseFormat('wav')
    ->save('output.wav');

// Get as stream (e.g., to send to browser)
$audioStream = $groq->audio()->speech()
    ->model('playai-tts')
    ->input('This is another example text')
    ->voice('Bryan-PlayAI')
    ->create();

header('Content-Type: audio/wav');
header('Content-Disposition: inline; filename="speech.wav"');
echo $audioStream;

Documentation

Updated README.md to include comprehensive documentation about the new TTS functionality.

Additional notes

  • Text-to-Speech requires acceptance of terms of use in the GroqCloud console
  • For more detailed examples, see examples/audio-speech.php
v1.0.0

GroqPHP v1.0.0

We are thrilled to announce the release of GroqPHP v1.0.0! 🎉

This marks a significant milestone as we celebrate our first anniversary. The initial commit was made on March 22, 2024, and after a year of development and iteration, we are proud to have reached 16,000+ downloads. This achievement is a testament to the growing adoption of our library in the PHP community.

What's New in v1.0.0

The 1.0.0 release represents a stable, feature-rich offering that builds upon previous versions with several significant improvements:

Files and Batch Processing

One of the most significant additions in this release is comprehensive support for the Groq Files and Batch Processing APIs:

  • File Management: Seamlessly upload, list, retrieve, download, and delete JSONL files for batch processing

    • Support for large file uploads (up to 100MB)
    • Automatic validation of file formats and content
    • Comprehensive error handling for all file operations
  • Batch Processing: Process large volumes of requests asynchronously

    • Create and manage batch jobs with detailed status tracking
    • Support for batch job creation, retrieval, listing, and cancellation
    • Detailed error reporting for batch operations

Other Enhancements

  • Improved Error Handling: Enhanced exception handling with more descriptive error messages
  • Updated Models Support: Added support for the latest Groq models, including Llama 3.1
  • Environment Variables: Improved handling of environment variables with better fallbacks
  • Comprehensive Testing: Added extensive test suite for all components
  • API Stability: Finalized API design with stable interfaces

Under the Hood

  • Fixed various warnings and potential type errors
  • Added GitHub Actions workflow for automated testing
  • Updated deprecated model references
  • Enhanced documentation with more examples

Breaking Changes

While we have made efforts to maintain backward compatibility, there are a few breaking changes to be aware of:

  • The minimum PHP version requirement remains at ^8.1.0
  • Some parameter names have been standardized for consistency

Contributors

We extend our heartfelt thanks to all contributors who have made this release possible:

And to all users who have provided valuable feedback and suggestions through issues, including @zachary, @EliasPereirah, @flemzord, and @mmddev87.

Looking Forward

As we move beyond v1.0.0, we remain committed to improving GroqPHP with new features, optimizations, and expanded model support. We encourage you to report issues and contribute to the project on GitHub.

v0.1.0

What's Changed

New Contributors

Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.10...v0.1.0

v0.0.10

What's Changed

Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.9...v0.0.10

v0.0.9

What's Changed

Add Vision functionality for image analysis and examples:

  • Added PHP files for Vision analysis and some examples like Vison Simple, Vision URL, Vision Multiple, and Vision Feedback.
  • Implemented forms to upload images or provide image URLs with prompts for analysis on examples.
  • fix: Prevent the language to be forced on the transcript endpoint by @tgeorgel in https://github.com/lucianotonet/groq-php/pull/6

New Contributors

Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.8...v0.0.9

v0.0.8

This release includes several enhancements and improvements to the Groq PHP package:

  • Enhanced error handling and improved API response management, including a new 'failed_generation' field for errors in JSON object responses
  • Updated examples with improved error handling and compatibility with the latest GroqException implementations
  • Refreshed README.md with new badges displaying version, total downloads, and license information
  • Updated package version to 0.0.8, ensuring access to the latest features and performance enhancements

These updates aim to provide a more robust and user-friendly experience when working with the Groq API through this PHP package.

Full Changelog: https://github.com/lucianotonet/groq-php/compare/v0.0.7...v0.0.8

v0.0.6

Add speech-to-text transcription and translation features

This introduces the ability to transcribe and translate spoken words from audio and video files.

Users can now:

  • Transcribe audio and video content into text.
  • Translate spoken words in audio and video content.
  • Provide a prompt for context or to specify the spelling of unfamiliar words.
  • Control the variability of transcriptions and translations with a temperature parameter.
  • Choose from various response formats, including JSON, verbose JSON, and plain text.

This functionality enhances the capabilities of the library, making it more versatile and useful for processing audio and video data.

v0.0.4
v0.0.3

Add stream functionality

v0.0.1

First version.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style