AI

Create a chat completion

OpenAI-compatible chat completions endpoint. Point any OpenAI SDK at baseURL https://api.squarecloud.app/v2/ai using your account API key, and call chat.completions.create.

Available on Standard, Pro and Enterprise plans. Each plan bounds requests per day, concurrency, pacing between requests and context/output size (Standard: 1,000 requests/day, 16k in / 4k out, 1 concurrent, 5s between requests. Pro: 5,000 requests/day, 24k / 6k, 1 concurrent, 2s. Enterprise: unlimited requests, 32k / 8k, 2 concurrent, no delay). Token usage is billed against your plan's daily AI budget, and each plan also has a daily fair-use allowance on the gateway sized for moderate use (Enterprise gets 5x the base allowance; both reset 00:00 UTC).

The model has a built-in web_search it can trigger on its own for current or external information; searches run server-side and only the final answer is returned. You may also declare your own tools (OpenAI function-calling format): the model's calls to them come back as a standard finish_reason: "tool_calls" response, and you send the results back as role: "tool" messages.

Streaming is not supported yet. Error responses use the OpenAI error shape ({ error: { message, type, code } }).

post/v2/ai/chat/completions

Request body

modelstring

Ignored; the response always reports cubic.

toolsobject[]

Your own tools, in the OpenAI function-calling format: { type: "function", function: { name, description, parameters } }.

{"stackTrail":"paths:/v2/ai/chat/completions:post:requestBody:content:application/json:schema:properties:tool_choice","oasType":"schema","type":"unknown","description":"\"auto\" (default), \"none\", \"required\" or { type: \"function\", function: { name } }."}
max_tokensinteger

Completion token cap; silently clamped to your plan's output ceiling.

temperaturenumber
streamboolean

Must be false/omitted (streaming not supported yet).

Response

The completion, in the OpenAI chat.completion shape. When the model calls one of YOUR tools, finish_reason is tool_calls and the message carries tool_calls instead of text.

idstring required
objectstring required
createdinteger required
modelstring required

Changes

No recorded changes to this endpoint across all 1 revision of this API.