فایلها و خروجیها
دو راه برای دانلود خروجی مدلها: GET /v1/assets/{id} نسخهٔ آینهشده روی سرور هرمز را میدهد (پیشنهادی، ۷ روز نگهداری، دانلود سریع از داخل ایران) و GET /v1/files/proxy?url=... بهعنوان مسیر جایگزین، فایل را از مبدأ از طریق هرمز عبور میدهد. فقط URL هایی پذیرفته میشوند که خود API در خروجی prediction برگردانده باشد.
/v1/files/proxyاحراز هویت BearerProxy-fetch a generated file
Streams a generated file through this gateway. Use it when:
- The source CDN URLs are blocked or slow on your network
- The asset mirror hasn't caught up yet (fallback after 90 seconds)
- You need a one-shot download without waiting for mirroring
Security: Only file URLs returned by this API (in a prediction's
output or urls) are accepted.
پارامترها
| فیلد | in | نوع | توضیح |
|---|---|---|---|
urlالزامی | query | string (uri) | HTTPS URL of a generated file, as returned in a prediction's
|
نمونه
پاسخها
200File content streamed to the client.
400The request body or query parameters are invalid. Check the
error.code and error.message fields for details. Codes the
gateway emits at 400:
BAD_REQUEST: generic malformed JSON / missing required field.INVALID_TOOLS: thetoolsarray,pluginsfield, or model's:onlinesuffix uses an unsupported shape. The response names the offender and links to the supported form. See the dedicatedInvalidToolsresponse below for the three triggers and migration hints.UNSUPPORTED_TOOL: a built-in tool (file_search,code_interpreter,computer_use,mcp) whose pricing dimension is not yet wired into the gateway hold estimator.INVALID_AUDIO_FORMAT:input_audio.formatvalue is not in the supported set. The envelope lists every supported codec name. The gateway accepts both short names (wav,webm) and full MIME aliases (audio/wav,audio/webm); anything else fails fast at admission. See API guide §8b.AUDIO_NOT_SUPPORTED_ON_RESPONSES:input_audiocontent part sent toPOST /v1/responses. The Responses API has no audio content type today; resend toPOST /v1/chat/completionsinstead.
401Authentication failed. Either the Authorization header is missing,
the key format is invalid, or the key doesn't match any active account.
{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required",
"status": 401
}
}403URL is not an accepted generated-file URL.
503The upstream AI provider is temporarily
unavailable. Retry with exponential backoff (1s, 2s, 4s) using the
same Idempotency-Key: if the upstream actually completed
the work and only the response failed, the gateway replays the
cached success without a second charge. Holds are released
automatically on upstream failures.
/v1/assets/{id}احراز هویت BearerDownload a mirrored asset
Download a file that our background worker copied to local storage.
These URLs appear in the assets[] array of completed predictions.
Advantages over the direct source URLs:
- Served from the same domain: no CDN blocking issues
- Available for 7 days (vs the source's 1-hour expiry)
- Faster download from within Iran
Assets are tenant-scoped: you can only download your own.
پارامترها
| فیلد | in | نوع | توضیح |
|---|---|---|---|
idالزامی | path | string (uuid) | Asset ID from the prediction's |
نمونه
پاسخها
200Asset file content.
401Authentication failed. Either the Authorization header is missing,
the key format is invalid, or the key doesn't match any active account.
{
"error": {
"code": "UNAUTHORIZED",
"message": "Authentication required",
"status": 401
}
}403This asset belongs to another account.
404Asset not found. It may have expired (7-day retention) or the mirror worker hasn't processed it yet.