幂等性
基础 URL https://arteza.ai/api/v1
OpenAPI 3.1 规范,用于 SDK 生成器和代理: /api/v1/openapi.json
官方 TypeScript 和 Python SDK、命令行工具和代理技能: SDK 和命令行工具
在创建生成时发送 Idempotency-Key 标头。用相同的密钥重复请求将返回原始生成,而不是启动并扣费第二次。用不同的请求体重用密钥将返回 idempotency_conflict。
curl https://arteza.ai/api/v1/generations \
-H "Authorization: Bearer $ARTEZA_API_KEY" \
-H "Idempotency-Key: order-1042-render" \
-H "Content-Type: application/json" \
-d '{"model": "flux-2-max", "input": {"prompt": "a lighthouse at dusk"}}'
# The same request again, after a timeout: the first generation comes back
HTTP/1.1 200 OK
Idempotent-Replayed: true使用属于该操作的值(例如订单 ID),然后在超时或连接断开后的每次重试中重新发送。重放的响应包含 Idempotent-Replayed: true 标头。密钥属于您的账户,保留 24 小时;之后相同的密钥将启动新的生成。