---
title: "Generate AI optimization suggestions for a simulation"
method: POST
path: "/simulations/{simulationId}/optimize"
tags: ["Understand"]
---

# Generate AI optimization suggestions for a simulation

`POST /simulations/{simulationId}/optimize`

## Request

- Base URL: `https://www.cloudworldmodel.ai/api`
- URL: `https://www.cloudworldmodel.ai/api/simulations/{simulationId}/optimize`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-PAYMENT`
  - API key in header `PAYMENT-SIGNATURE`

Uses GPT-5 to analyse the simulation's current resource configuration and
metric history and return prioritised suggestions for reducing cost,
improving reliability, or increasing performance.

Set `beginnerMode: true` for simplified language.

**Authentication:** Requires an API key (`write` scope) or an x402
micro-payment (3 credits — $0.0030 USDC on Base). Pass
`Authorization: Bearer <key>` for API key access, or include a signed
x402 payment header (no account required). Use
`GET /api/billing/x402/config` to discover the live price.

## Path parameters

- `simulationId` string, required

## Request body

- object
  - `beginnerMode` boolean: Return simplified suggestions

## Response `200`

AI optimisation suggestions

- object
  - `suggestions` string: Prioritised optimisation recommendations

## Other responses

- `401`: Authentication required or invalid API key
- `402`: Payment required — the endpoint is metered and no API key was provided. The response body follows the [x402 v2 protocol](https://x402.org) and describes one or more USDC payment options that the caller can select before retrying the request. Base is always the first option and uses `X-PAYMENT`. When an `accepts` entry for Solana is present, it is an additional USDC-SPL option that uses `PAYMENT-SIGNATURE` and its `extra.feePayer` value. The server verifies either payment through the PayAI facilitator at `https://facilitator.payai.network`. The `PAYMENT-REQUIRED` response header carries this entire JSON body as a base64-encoded string for protocol-aware clients. Call `GET /api/billing/x402/config` to retrieve the current price table and wallet address and `paymentOptions` before constructing a payment.
- `404`: Resource not found
- `429`: Rate limit exceeded
- `500`: Internal server error

---

[API](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api.md) · [All operations](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api/revisions/ecc3ad1ff07f?raw)
