Skip to main content
string
required
The API key for your account. You can find this in your account settings.
The AI Gateway lets you use Square Cloud’s hosted AI model inside your own products — chatbots, assistants, automations — through an OpenAI-compatible chat completions endpoint. If your code already speaks the OpenAI API, it speaks the AI Gateway too: point the SDK at our base URL, use your account API key, and set the model to cubic.
The AI Gateway is in beta with free early access: during the beta there is no extra charge beyond your plan’s daily AI token budget. Limits and plan availability may change when the beta ends.

How to connect

  • Base URL: https://api.squarecloud.app/v2/ai
  • API key: your account API key (the same one used by the Square Cloud API and CLI, from the account page). The Authorization header is accepted with or without the Bearer prefix.
  • Model: cubic — Square Cloud’s hosted model, the same one powering the dashboard AI assistant.

Plans and limits

Requests are unlimited; every request bills its real tokens against your plan’s daily AI token budget (the same budget the dashboard assistant uses, reset at 00:00 UTC).
Hobby plans (and accounts without a plan) do not have AI Gateway access — upgrading to Standard or above enables it.

Request contract

string
Accepted for SDK compatibility; the gateway always answers as cubic.
array
required
OpenAI-style messages with roles system, user, assistant and tool. Content must be a string (no images/vision yet). Up to 100 messages per request.
number
Silently clamped to your plan’s output ceiling.
number
From 0 to 2.
array
Function calling in the standard OpenAI format, up to 32 tool definitions. Tool calls come back as finish_reason: "tool_calls", and you send results back as role: "tool" messages.
string | object
Standard OpenAI tool_choice values.
Unknown parameters are ignored. Not supported yet: streaming (stream: true returns 400 stream_not_supported) and images/vision. The model decides on its own to search the web when the conversation asks for current or external information. Searches run server-side, and only the final answer is returned, citing result URLs. If you declare your own tool named web_search, yours replaces the built-in one.

Errors

Errors use the OpenAI shape: { "error": { "message", "type", "code" } }.

Frequently asked questions

No — the API is stateless, exactly like OpenAI’s: send the conversation history in messages on every request.
cubic, Square Cloud’s hosted model. There is no model list to choose from; the model field is accepted for SDK compatibility.
Yes — that is the main use case. It is a normal HTTPS API, so it works from anywhere.
Yes: both consume the same daily AI token budget, so heavy gateway usage drains the budget available to the dashboard assistant and vice versa.