Create a chat completion
Changed onOpenAI-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: 2.5M tokens/day and 10M/week, 1,000 requests/day, 16k in / 4k out, 1 concurrent, 5s between requests. Pro: 5M tokens/day and 20M/week, 5,000 requests/day, 24k / 6k, 1 concurrent, 2s. Enterprise: 10M to 20M tokens/day by plan size and 4x that per week, unlimited requests, 32k / 8k, 2 concurrent, no delay). These gateway token limits are separate from the dashboard assistant. Each plan also has a daily fair-use allowance on the gateway sized for moderate use (Pro 2x and Enterprise 5x the base allowance). Daily limits reset at 00:00 UTC, weekly ones on Monday at 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 } }).
Request
- Base URLhttps://api.squarecloud.app
- AuthAPI key in header Authorization
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
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.
Changes
- warning
added the new
weekly_limit_reachedenum value to the//response property for the response status - warning
added the new
weekly_limit_reachedenum value to the//response property for the response status - warning
added the new
weekly_limit_reachedenum value to the//response property for the response status - warning
added the new
weekly_limit_reachedenum value to the//response property for the response status - warning
added the new
weekly_limit_reachedenum value to the//response property for the response status - warning
added the new
weekly_limit_reachedenum value to the//response property for the response status - warning
added the new
weekly_limit_reachedenum value to the//response property for the response status - info
added the new optional request property
- warning
- breaking
removed the required property
from the response with the status - breaking
removed the required property
from the response with the status - breaking
removed the required property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - warning
removed the optional property
from the response with the status - info
added the required property
to the response with the status - info
added the required property
to the response with the status - info
added the required property
to the response with the status
- breaking