Connect with the lashot API
Use this path for a new integration: one key, one /v1 shape, no vendor SDK.
Set $LASHOT_BASE to your deployed API address. Local development uses http://localhost:8080; ask your deployment administrator for the production address. These instructions do not imply that a public production service is live.
1. Prepare
- Create an API key on the Keys page. The secret is shown once. This example requires
models:read,generations:write,generations:read,assets:read, and current project access. - Use
sandbox/imageto verify the request flow with test results. Check Models & pricing for its current price and for live model codes, such asark/seedream-4. - Send
x-api-key: $LASHOT_KEY, orAuthorization: Bearer $LASHOT_KEY.
2. List models you can call
curl -sS "$LASHOT_BASE/v1/models" \
-H "x-api-key: $LASHOT_KEY"
3. Generate an image
curl -sS -X POST "$LASHOT_BASE/v1/images/generations" \
-H "x-api-key: $LASHOT_KEY" \
-H "content-type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "sandbox/image",
"prompt": "a lighthouse at dusk, long exposure",
"n": 1
}'
The response is 202 with a job (object is job). Save id.
4. Read the result
curl -sS "$LASHOT_BASE/v1/jobs/$JOB_ID" \
-H "x-api-key: $LASHOT_KEY"
When status is succeeded, a new private project's outputs[].url is a root-relative path such as /v1/asset-versions/{id}/content. Every read checks current access and media review. Set $VERSION_ID to the output's asset_version_id and download from the same API:
curl --fail -sS "$LASHOT_BASE/v1/asset-versions/$VERSION_ID/content" \
-H "x-api-key: $LASHOT_KEY" -o result.png
Never send the platform key to an external storage URL or follow redirects with credentials. The TypeScript SDK provides lashot.assets.download(versionId), returning a Response. Historical signed URLs for organization-shared assets still expire; pending or rejected versions cannot be downloaded. You can also subscribe to GET /v1/jobs/$JOB_ID/events (SSE), then fetch the job again.
For video, post to /v1/videos/generations with sandbox/video or a video model from the catalog.
Conventions
| Topic | Rule |
|---|---|
| JSON | snake_case keys |
| Money | minor units (fen), as a string |
| Time | UTC ISO 8601 |
| Writes | send Idempotency-Key; same key and body replay for 24h |
| Rate limits | 429 includes Retry-After |
Next
- Already on Ark / DashScope / Kling / MiniMax / Qianfan: existing SDK.
- Every method and field: All endpoints in the console, or
GET $LASHOT_BASE/openapi.json. - Skip the script: use Playground.