Documentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/groq/llms.txt
Use this file to discover all available pages before exploring further.
GroqProvider (namespace AiSdk\Groq) is the concrete provider object that backs the Groq facade. It is returned by Groq::create() and holds the resolved GroqOptions for the lifetime of the provider instance. While most applications interact with the Groq facade rather than GroqProvider directly, working with GroqProvider directly gives you full control: you can create multiple independent provider instances with different API keys, base URLs, or custom headers within the same process.
In the majority of applications you will not need to instantiate or reference
GroqProvider directly. Use the Groq facade’s static methods — Groq::create(), Groq::model() — and let the facade manage the provider for you.Constructor
new GroqProvider(GroqOptions $options)
Constructs a provider from an already-built GroqOptions value object. In practice, you will most often obtain a GroqProvider through Groq::create(), which calls GroqOptions::fromArray() internally and passes the result here.
Constructing a GroqProvider directly
A fully constructed
GroqOptions instance carrying the API key, base URL, extra headers, and optional custom SDK. See the GroqOptions reference for all available fields.Properties
$options
GroqOptions instance supplied at construction time. Because it is readonly, the reference cannot be replaced after construction, but you can read any field from it at any time.
Reading resolved options
Methods
name()
Returns the canonical provider identifier string used internally by the SDK to tag requests, errors, and capability lookups.
Checking the provider name
Always
'groq' — the value of GroqOptions::PROVIDER_NAME.textModel()
Creates and returns a GroqTextModel for the given model ID. The returned object implements TextModelInterface and can be passed directly to Generate::text()->model(...).
Creating a text model from the provider
The Groq model identifier (e.g.
'llama-3.3-70b-versatile', 'llama-4-scout-17b-16e-instruct'). The value is passed through to the underlying GroqTextModel without validation; an invalid ID will produce an API-level error when the model is invoked.A
GroqTextModel instance implementing AiSdk\Contracts\TextModelInterface. The model captures the provider’s GroqOptions and the resolved model registry so that capability checks and HTTP requests are fully configured.Using multiple providers
BecauseGroqProvider is a plain object, you can hold multiple instances simultaneously — useful when your application needs to fan out requests across different Groq API keys or route to a proxy for specific environments:
Multiple independent providers