跳转到内容

/t1/imagegen 任务查询/找回:queued/running 携 pollIntervalMs;succeeded 携 result(同步径响应同形)+ cost/currency(实结,同步径 x-tansr-cost 头同值);failed 携 error{code,message};执行预算窗尽未终态判 interrupted(最终扣费状态以用量记录为准);轮询频控同 limiterIdFor

GET
/t1/imagegen/tasks/{id}
curl --request GET \
--url https://api.tansr.com/t1/imagegen/tasks/example \
--header 'x-tansr-key: <x-tansr-key>' \
--header 'x-tansr-key-id: <x-tansr-key-id>'
id
required
string

任务 id(POST …/tasks 202 响应 taskId;归属 = owner + App 键 + endUser 三键精确匹配,异面 kind / 他人恒同形 404)

x-tansr-ts
string
/^\d{1,15}$/

签名时间戳(unix 秒,十进制串;T-A34):与服务器时钟偏差 >300s → 401 signature_invalid

x-tansr-nonce
string
>= 16 characters <= 128 characters

签名随机数(≥16 字符;T-A34):同 keyId 600s 窗内重现 → 401 nonce_replayed

x-tansr-sign
string
/^[0-9a-f]{64}$/

请求签名(hex 小写;T-A34):HMAC-SHA256(K=sha256(SK 明文) 原始摘要, TWP1-HMAC-SHA256\n{METHOD}\n{path+query}\n{ts}\n{nonce}\n{sha256hex(rawBody)});三头须同现,在场恒校验;app signRequired 或 TANSR_API_TWP_REQUIRE_SIGNATURE=1 时未签名恒 401 signature_invalid

任务态

Media typeapplication/json
object
taskId
required
string
status
required
Any of:
string
Allowed value: queued
model
required
string
createdAt
required

提交时刻(ISO)

string
startedAt

开始执行时刻(ISO;queued 行缺席)

string
completedAt

终态时刻(ISO;非终态缺席)

string
pollIntervalMs

建议轮询间隔(仅非终态在场)

integer
result
object
model
required

请求 model 回显(S-G1 缺省径 = 生效模型 canonical handle,调用方由此得知实际所用模型)

string
images
required

成功图像(url 与 b64Json 恒二选一在场;媒体二批起 b64 直回家族点亮)

Array<object>
object
url

图像直链(上游口径 24h/7d 有效,及时转存;URL 直回形态行)

string
b64Json

Base64 图像数据(b64 直回形态行:gemini/flux/gpt-image 系)

string
mimeType

MIME 类型(b64 形态随报,如 image/png)

string
imageCount
required

成功张数(per_image 行 = 计费口径;token/per_call/百万像素行计费按上游报量,见 usage)

integer
taskId

上游任务 id(midjourney 系随报;动词行 action.taskId 引用源)

string
actions

可续跳动作位(midjourney imagine/动词响应随报;凭此调用 reroll/upscale/variation 行)

Array<object>
object
actionId
required

动作引用 id(midjourney buttons.custom_id;动词行 action.actionId 引用源)

string
label

动作标签(如 U1/V2/🔄)

string
cost

实结金额(DECIMAL 字符串;仅 succeeded 在场,同步径 x-tansr-cost 头同值)

string
currency
string
error

Failed 终态错误位

object
code
required

失败错误码(同步端点错误码同词表;interrupted = 服务端中断[如重启],终局扣费状态以用量/台账为准)

string
message
required

失败因由短句(恒不含提示词与上游响应体)

string
Example
{
"status": "queued"
}

App_key_invalid / 令牌无效或过期 / signature_invalid / nonce_replayed(T-A34)

Media typeapplication/json
object
error
required
object
code
required

错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)

string
Allowed values: adjudicator_not_authorized admin_forbidden admin_key_invalid app_disabled app_ip_denied app_key_invalid approval_self_forbidden asr_not_configured asr_quota_exceeded auth_channel_undelivered bad_request conflict content_blocked context_window_exceeded currency_not_supported device_code_denied device_code_expired device_code_pending device_code_slow_down egress_blocked endpoint_disabled envelope_key_undelivered fence_denied forbidden idempotency_conflict idp_untrusted image_not_supported imagegen_not_configured imagegen_quota_exceeded insufficient_balance internal_error invalid_api_key license_required limit_exceeded liquidation_not_enabled model_not_authorized model_not_found nonce_replayed not_found order_state_invalid org_byok_not_available org_ceiling_exceeded otp_invalid otp_rate_limited pay_amount_mismatch pay_channel_undelivered pay_signature_invalid payload_too_large payment_required plan_apps_exceeded plan_concurrency_exceeded plan_end_users_exceeded plan_gate_unavailable plan_members_exceeded plan_required plan_tier_insufficient policy_locked pool_signing_undelivered preflight_required pricing_guard_tripped principal_required protocol_unsupported quota_exceeded rate_limited refund_not_eligible section_not_deliverable session_archived signature_invalid stream_backpressure token_expired tts_not_configured tts_quota_exceeded unauthorized upstream_connect_timeout upstream_disconnected upstream_error upstream_idle_timeout upstream_timeout upstream_total_timeout upstream_ttfb_timeout validation_failed videogen_not_configured videogen_quota_exceeded websearch_not_configured websearch_quota_exceeded
message
required
string
requestId
required
string
detail
object
Example
{
"error": {
"code": "adjudicator_not_authorized"
}
}

Not_found(异面 kind / 他人 / 不存在,恒同形不泄露存在性)

Media typeapplication/json
object
error
required
object
code
required

错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)

string
Allowed values: adjudicator_not_authorized admin_forbidden admin_key_invalid app_disabled app_ip_denied app_key_invalid approval_self_forbidden asr_not_configured asr_quota_exceeded auth_channel_undelivered bad_request conflict content_blocked context_window_exceeded currency_not_supported device_code_denied device_code_expired device_code_pending device_code_slow_down egress_blocked endpoint_disabled envelope_key_undelivered fence_denied forbidden idempotency_conflict idp_untrusted image_not_supported imagegen_not_configured imagegen_quota_exceeded insufficient_balance internal_error invalid_api_key license_required limit_exceeded liquidation_not_enabled model_not_authorized model_not_found nonce_replayed not_found order_state_invalid org_byok_not_available org_ceiling_exceeded otp_invalid otp_rate_limited pay_amount_mismatch pay_channel_undelivered pay_signature_invalid payload_too_large payment_required plan_apps_exceeded plan_concurrency_exceeded plan_end_users_exceeded plan_gate_unavailable plan_members_exceeded plan_required plan_tier_insufficient policy_locked pool_signing_undelivered preflight_required pricing_guard_tripped principal_required protocol_unsupported quota_exceeded rate_limited refund_not_eligible section_not_deliverable session_archived signature_invalid stream_backpressure token_expired tts_not_configured tts_quota_exceeded unauthorized upstream_connect_timeout upstream_disconnected upstream_error upstream_idle_timeout upstream_timeout upstream_total_timeout upstream_ttfb_timeout validation_failed videogen_not_configured videogen_quota_exceeded websearch_not_configured websearch_quota_exceeded
message
required
string
requestId
required
string
detail
object
Example
{
"error": {
"code": "adjudicator_not_authorized"
}
}

Rate_limited(轮询频控)

Media typeapplication/json
object
error
required
object
code
required

错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)

string
Allowed values: adjudicator_not_authorized admin_forbidden admin_key_invalid app_disabled app_ip_denied app_key_invalid approval_self_forbidden asr_not_configured asr_quota_exceeded auth_channel_undelivered bad_request conflict content_blocked context_window_exceeded currency_not_supported device_code_denied device_code_expired device_code_pending device_code_slow_down egress_blocked endpoint_disabled envelope_key_undelivered fence_denied forbidden idempotency_conflict idp_untrusted image_not_supported imagegen_not_configured imagegen_quota_exceeded insufficient_balance internal_error invalid_api_key license_required limit_exceeded liquidation_not_enabled model_not_authorized model_not_found nonce_replayed not_found order_state_invalid org_byok_not_available org_ceiling_exceeded otp_invalid otp_rate_limited pay_amount_mismatch pay_channel_undelivered pay_signature_invalid payload_too_large payment_required plan_apps_exceeded plan_concurrency_exceeded plan_end_users_exceeded plan_gate_unavailable plan_members_exceeded plan_required plan_tier_insufficient policy_locked pool_signing_undelivered preflight_required pricing_guard_tripped principal_required protocol_unsupported quota_exceeded rate_limited refund_not_eligible section_not_deliverable session_archived signature_invalid stream_backpressure token_expired tts_not_configured tts_quota_exceeded unauthorized upstream_connect_timeout upstream_disconnected upstream_error upstream_idle_timeout upstream_timeout upstream_total_timeout upstream_ttfb_timeout validation_failed videogen_not_configured videogen_quota_exceeded websearch_not_configured websearch_quota_exceeded
message
required
string
requestId
required
string
detail
object
Example
{
"error": {
"code": "adjudicator_not_authorized"
}
}