Skip to main content
You can call the Architect with the OpenAI SDK you already use. Point the client at Pascal’s base URL, use your Pascal API key, and ask for the pascal-architect model. Requests and responses use the OpenAI Responses format, with Pascal-specific values in metadata. For what a turn does and returns, see Pascal API (v1).

Before you start

  • An API key. Create one in Settings under API keys, the same keys the MCP server uses. Its user or organization must be able to edit the project.
  • A project id. Every request works on an existing project.
  • Credits. Turns are paid with Pascal credits. See Credits.
Every example on this page runs as is once you set these two variables:
Install the SDK for your language:
The TypeScript and AI SDK examples are ES modules with top-level await. Save one as example.ts and run it with npx tsx example.ts.

Point the client at Pascal

Set the base URL to https://editor.pascal.app/api/v1 and pass your Pascal API key. Name the project in metadata.project_id, and the Architect does the turn.
You can also name the project with the X-Pascal-Project header, for example through the client’s default headers. The header wins over metadata.project_id. With the AI SDK, always pass maxRetries: 0. The AI SDK retries by status code, and a retried turn could edit the scene twice. The OpenAI SDKs already obey Pascal’s x-should-retry: false header.

Choose an effort

pascal-architect runs at medium effort unless you set reasoning.effort. To fix the effort, use a model with a suffix instead:
Each model is also available without the pascal- prefix, as architect, architect-high and so on. Both names run the same model. GET /v1/models lists them all. If your plan doesn’t include the effort you asked for, the request is refused with 403 upgrade_required.

Cap the credits a turn spends

Set metadata.pascal_max_credits to the most credits the turn may spend. It’s a string, like every metadata value.
A turn that reaches the cap stops starting new work, keeps what it finished, and saves it as a version. A value that isn’t a number above 0 is refused with a 400, so a turn never runs uncapped by mistake. See Cap the credits a turn spends for how close to the cap a turn ends.

Run a long turn in the background, and cancel it

Send background: true for work that may take a while, such as building a floor from a plan. The request answers queued at once with the response id. Poll it with responses.retrieve, and stop it with responses.cancel.
A background turn runs to its end with nobody connected. Credits are charged and the version is saved as for any other turn. It ends completed, incomplete, failed or cancelled. Cancelling stops the turn the way the editor’s Stop does, and returns the response as it ended. Cancelling a turn that already ended returns it as it ended. Any key that can edit the project can read its turns, but you can only cancel turns started with your account’s keys. Cancelling someone else’s turn returns 404 turn_not_found, as for a turn that doesn’t exist. Without background, a request follows its turn for up to 13 minutes. A turn still running then is stopped, except a pascal-architect-pro turn, which keeps running and answers status: "in_progress" for you to poll.

Retry without starting a second turn

A turn edits the scene and spends credits. If a request times out and you don’t know whether its turn started, send it again with the same Idempotency-Key: you get back the turn the first request started, as it stands now, instead of a second turn.
A replayed answer carries Idempotent-Replayed: true. Pascal keeps a key for 24 hours, for you and the project the request names. The same key with a different request returns 409 idempotency_mismatch, so use a new key for each new request.

Handle errors

An error comes back with an HTTP status and an error object, which each SDK turns into an exception. Read the code to decide what to do.
Don’t retry a failed turn automatically: it may already have edited the scene. Every error tells the SDKs not to retry it, except 429 rate_limit_exceeded: nothing ran, so the OpenAI SDKs wait the Retry-After seconds and send it again on their own. With the AI SDK and maxRetries: 0, wait Retry-After yourself. A request without enough credits gets 402 insufficient_quota. An unknown model is refused with model_not_found, and the message lists the valid names. A bad metadata.pascal_max_credits gets 400 invalid_input. Each error’s doc_url links to Errors, which lists every code.

Get the request id for support

Every answer carries a Request-Id header. A turn’s reply also carries x-request-id, the same value as its response id; every other answer, each error included, carries the Request-Id value there. Each SDK gives it to you, so you can include it when you contact Pascal.
A refused request has a request id too: error.request_id in Python, error.requestID in TypeScript, and the x-request-id header of the AI SDK’s APICallError.responseHeaders.

Next steps