Drive a computer through an OpenAI-shaped endpoint
The agent loop behind a door an OpenAI client already knows how to open, for callers who would rather point an existing client at a base URL than integrate a new one. Same loop and the same X-Model-Key behavior as the BYOK computer agent. This route always requires your own key; funded AI is unavailable here.
Four things are ours rather than OpenAI’s. computer_id on the body is required, and there is nowhere else to put it: this endpoint has no computer in its path. provider and max_steps are optional and mean what they mean on /computers/{id}/agent. And the response carries an agent block beside the OpenAI fields, saying what the loop did. Everything else reads the way an OpenAI client already writes it — the prompt is the last user message, the user and assistant messages before it are the conversation so far (given to the model as turns it is told are done), and any system messages become the system prompt. thread_id and store keep and continue a conversation as on /computers/{id}/agent; with thread_id the thread’s own turns are the conversation and earlier messages you send are not read, so resending the whole history each call is harmless. A new thread starts with the messages you sent, and its id comes back as agent.thread_id (on the last chunk when streaming). Only the documented top-level fields are accepted; unknown fields are a 400.
BESIDES THE KEY IT NEEDS, ONE BEHAVIOUR DIFFERS FROM THE ROUTE ABOVE, because this door follows OpenAI’s contract rather than ours: this endpoint does not stream unless you ask it to — omit stream and you get one JSON completion, which is the opposite of /computers/{id}/agent. model and provider choose the provider the same way on both routes; use a model that supports computer use, such as gpt-6.1-sol.
On the hosted API a run that does not stream — this endpoint’s default — is cut off at the edge after about 120 seconds (a 524 with no body), and its result, the usage and the steps it took, is lost with it. The run is stopped where it was once the dropped connection reaches the platform, so do not assume it finished. A run at the default max_steps can easily take longer: send stream: true for anything that may.
The computer must already be running — this endpoint will not start one for you, because starting is billable and not a decision to make on your behalf.
Requires the member role or higher.
Request
- Base URL: https://app.mandala.computer/api/v1
- URL: https://app.mandala.computer/api/v1/chat/completions
- Auth: HTTP bearer
Headers
Your own key for the selected Anthropic or OpenAI provider. Never stored. The provider bills you directly; no Mandala AI credits are spent. A key whose prefix belongs to the other provider (sk-ant- for OpenAI, any other sk- key for Anthropic) is a 400.
Request body
Response
One ChatCompletion, or with stream: true an SSE stream of OpenAI-style chunks.
Each chunk is data: {id, object: "chat.completion.chunk", created, model: "computer-use-agent", choices: [{index: 0, delta, finish_reason}]}. The first chunk’s delta carries role: "assistant"; each action the loop takes arrives as a line of delta.content ([n] what it did), then the model’s text; the last chunk has an empty delta and the finish_reason described on ChatCompletionChoice. The stream carries no usage and no agent block, so a streamed run cannot tell a finished run from one that ran out of rate budget — send stream: false when that matters and the run is short enough. A run that fails arrives as data: {error, request_id} with the OpenAIErrorDetail shape under error. The stream ends with data: [DONE], and lines starting : carry nothing: a : run starting line first, then : keepalive lines while the run goes quiet.
Changes
No recorded changes to this operation across all 1 revision of this API.