Download the PHP package rmh/vertex without Composer
On this page you can find all versions of the php package rmh/vertex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package vertex
Short Description A provider for Prism adding support for Google Vertex AI.
License MIT
Informations about the package vertex
Prism Vertex
A standalone Google Vertex AI provider for the Prism PHP framework. Access Google Gemini and partner model families through a single configuration and unified interface.
Installation
Configuration
Add the following to your Prism configuration (config/prism.php):
Standard mode (project + location required)
Express mode (API key only, Google models only)
When project_id and location are omitted, the package automatically uses Vertex AI Express Mode endpoints:
[!IMPORTANT] Express mode only supports Google Gemini models. Using partner model providers in Express mode will throw an exception.
Usage
Use the provider constants from Prism\Vertex\Enums\Vertex with the Prism facade:
Text Generation
Structured Output (JSON)
Embeddings
Streaming
[!WARNING] Streaming is not yet supported. This feature is planned for a future release.
Supported Providers
All providers share one vertex config block. The provider constant determines which API schema and publisher endpoint is used:
| Constant | Publisher | Example Models | Schema |
|---|---|---|---|
Vertex::Gemini |
google |
gemini-2.5-flash, text-embedding-005 |
Gemini |
Vertex::Anthropic |
anthropic |
claude-3-5-sonnet@20241022, claude-3-5-haiku@20241022 |
Anthropic |
Vertex::Mistral |
mistralai |
mistral-small-2503, codestral-2501 |
OpenAI |
Vertex::Meta |
meta |
llama-4-scout-17b-16e-instruct-maas |
OpenAI |
Vertex::DeepSeek |
deepseek |
deepseek-v3-0324-maas |
OpenAI |
Vertex::AI21 |
ai21 |
jamba-1.5-mini@001, jamba-1.5-large@001 |
OpenAI |
Vertex::Kimi |
kimi |
kimi-k2-0711-maas |
OpenAI |
Vertex::MiniMax |
minimax |
minimax-m1-40k-0709-maas |
OpenAI |
Vertex::OpenAI |
openai |
gpt-oss-4o-mini-maas |
OpenAI |
Vertex::Qwen |
qwen |
qwen2.5-72b-instruct-maas |
OpenAI |
Vertex::ZAI |
zaiorg |
glm-4-plus-maas |
OpenAI |
API Schemas
Prism Vertex uses three API schemas to handle the different formats used by Vertex AI publishers:
| Schema | Text | Structured | Embeddings |
|---|---|---|---|
| Gemini | yes | yes | yes |
| Anthropic | yes | yes | no |
| OpenAI | yes | yes | no |
- Gemini — Google's native
generateContent/predictendpoints. - Anthropic — Uses
:rawPredictwith the Anthropic Messages API format (anthropic_version: vertex-2023-10-16). - OpenAI — Uses
:rawPredictor:chatCompletionswith OpenAI-compatible format for partner models (Mistral, Meta, DeepSeek, AI21, Kimi, MiniMax, OpenAI-OSS, Qwen, ZAI).
The provider constant automatically selects the correct schema. You can override it via withProviderOptions():
Structured Output Details
Each schema handles structured output differently:
- Gemini — Native structured output via
response_mime_type: application/jsonandresponse_schema. The model is constrained to produce valid JSON matching your schema. - OpenAI — Uses
response_format: { type: "json_object" }combined with a schema instruction message. All MaaS partner models support this mode. - Anthropic — No native JSON mode. A prompt is appended instructing the model to respond with JSON conforming to the provided schema.
You can override the schema instruction prompt for Anthropic and OpenAI schemas using withProviderOptions():
Authentication
API Key
Set the api_key config option. The key is sent as a ?key= query parameter on every request. This works for both Standard and Express modes.
Service Account JSON file
Set the credentials config option to the path of your service account JSON key file. The package uses google/auth to obtain a Bearer token automatically.
Application Default Credentials (ADC)
When neither credentials nor api_key are set in Standard mode, the package automatically uses Application Default Credentials. This is the recommended approach for code running on Google Cloud Platform, no credentials need to be configured at all.
ADC resolves credentials in this order:
GOOGLE_APPLICATION_CREDENTIALSenvironment variable (path to a JSON key file)gcloud auth application-default login(local development)- Attached service account (GCE, GKE, Cloud Run, Cloud Functions, etc.)
Per-Provider Config Overrides
All providers read from the shared vertex config. If you need different credentials for a specific provider, add a per-provider config block — it will override the shared config:
Requirements
- PHP 8.2+
- Laravel 11 or 12
- prism-php/prism >= 0.99.7
License
The MIT License (MIT). Please see License File for more information.
All versions of vertex with dependencies
laravel/framework Version ^11.0|^12.0
google/auth Version ^1.0
prism-php/prism Version >=0.99.16