Introduction
Laravel Cloud’s model gateway gives your applications access to models from Anthropic, OpenAI, Google, Mistral, xAI, and many other providers through one API key. You don’t need an account with each provider or a separate bill for each one. Instead, you add credits to your organization once, and every request your applications make through the gateway draws from that balance. The gateway speaks the OpenAI Chat Completions and Anthropic Messages formats, so it works with the Laravel AI SDK and with any client that already talks to those APIs.The model gateway is in early access. Request access and we’ll enable the gateway for your organization as soon as it is ready.
Getting started
Using the gateway takes three steps: add credits, attach a gateway key to your environment, and deploy.1
Add credits
From your organization, open Resources > Model gateway, then click the Credits button. Enter an amount, accept the model gateway terms, and click Pay. See adding credits to learn more.
2
Attach a key to your environment
Open the environment’s canvas, click Add resource, then choose Model gateway. Select an existing key or click Create new gateway key, review the variable Laravel Cloud will inject, then click Confirm and attach key.
3
Deploy the environment
Deploy the environment for your application to receive the
LARAVEL_CLOUD_MODEL_GATEWAY_API_KEY variable.Models
To browse the available models, open Resources > Model gateway > Models. You may search the list and filter it by provider or by API format. Each model’s page lists its model ID, context window, maximum output, pricing, and links to the provider’s documentation and terms. You reference a model by its ID. Most IDs include the provider, such asopenai/gpt-5-5 or mistral/mistral-large-3. Anthropic models omit the provider, so you reference them as claude-sonnet-5.
API formats
Every model uses exactly one API format, shown on the model’s page. Use the endpoint that matches the model you are calling:
The REST API section of the model gateway’s Overview page shows the full URL for each format, along with ready-to-copy examples for the Laravel AI SDK and cURL.
Gateway keys
Gateway keys authenticate your requests. Keys belong to your organization, and you may attach one key to as many environments as you like, though each environment may only have one key attached at a time. Every gateway key begins withlcai_.
Creating keys
The simplest way to create a key is from the environment canvas while attaching the gateway. Laravel Cloud names the key after the application and environment, then injects it into the environment for you, so you never need to copy it. To create a key for use outside Laravel Cloud, such as on your local machine or another server, open Resources > Model gateway, then click Create key in the Gateway keys section. Enter a name and choose an access level, then click Create key. Laravel Cloud displays the key once. Copy it and store it somewhere safe, since you won’t be able to view it again. Key names must be unique among your organization’s active keys.Access levels
Each key has one of two access levels:
Keys are external by default. If a key will only ever be used by your Cloud environments, make it internal, so a leaked key is useless anywhere else. You may change a key’s access level at any time, and the change takes effect immediately.
Editing and revoking keys
To rename a key or change its access level, open the key’s … menu and select Edit. The key’s panel also shows its ID, the last four characters of the key, and when it was last used. To revoke a key, open the key’s … menu and select Revoke, then type the key’s name to confirm. Revoking a key immediately stops every request that uses it and detaches it from all of its environments. You can’t undo this. Revoked keys remain in the list for 14 days, and you may reuse a revoked key’s name for a new key.Attaching a key to an environment
Attaching a key requires the Edit environments permission.1
Add the resource
Open the environment’s canvas, click Add resource, then choose Model gateway.
2
Select or create a key
Select one of your organization’s keys, or click Create new gateway key to create one for this environment.
3
Review and confirm
Review the variable Laravel Cloud will inject, then click Confirm and attach key.
4
Deploy the environment
Deploy the environment for your application to receive the key.
Injected environment variables
Attaching a key injects the following variable into the environment:LARAVEL_CLOUD_MODEL_GATEWAY_API_KEY variable, Laravel Cloud removes it when you attach the key so the injected value can take effect.
Configuring your application
- Laravel AI SDK
- cURL
- Other clients
Add a For models that use the Anthropic Messages format, use the Then, specify the provider and model when prompting an agent:
laravel-cloud provider to your application’s config/ai.php configuration file. For models that use the OpenAI Chat Completions format, use the openai-compatible driver:anthropic driver and the Anthropic base URL:Credits
The model gateway is prepaid. Your organization keeps a single credit balance, and Laravel Cloud deducts the cost of each request from it based on the tokens the request used. Gateway usage is billed separately from your plan, so your plan’s included usage does not cover it. Your remaining balance appears on the Credits button of the model gateway’s Overview page and on the Model gateway card of every environment with an attached key. Both show a Running low warning when your balance drops below $5.Adding credits
To add credits, click the Credits button on the model gateway’s Overview page, enter an amount between $10 and $10,000, then click Pay. The first time you add credits, you must accept the model gateway terms. To prevent abuse, new organizations may add up to $50 in credits per billing period and can’t enable automatic top-up. These limits lift as your organization builds a payment history with Laravel Cloud.Automatic top-up
To keep your applications from running out of credits, you may have Laravel Cloud add credits automatically. Open the Automatic top-up tab of the credits dialog, then enter a top-up amount and a threshold. Whenever your balance falls below the threshold, Laravel Cloud charges your card for the top-up amount. Both values must be at least $10, and you must have a balance before you enable automatic top-up. If an automatic top-up fails, Laravel Cloud notifies you through your organization’s payment notifications, and gateway requests stop once your balance runs out.Running out of credits
When your balance reaches zero, the gateway rejects requests from every key in your organization. Your applications should handle these failures gracefully. As soon as you add credits, the gateway accepts requests again without any further action.Logs and metrics
The model gateway’s Overview page charts your organization’s requests, tokens, and costs over the last hour, day, 7 days, or 30 days. The Logs page lists each request your applications make through the gateway, with its model, token usage, duration, cost, and HTTP status. Click a request to view its full details, including cache usage, the endpoint, and the key that made it. Requests appear about a minute after they finish. Laravel Cloud records metadata about each request, but it never stores your prompts or the model’s responses.Permissions
The model gateway has its own permissions:
The Admin, Manager, and Developer roles include all four permissions, while the Viewer role can only view. With custom roles, you may grant them separately. Attaching a key to an environment requires the Edit environments permission, and adding credits requires the Edit organization billing permission.

