همه صفحه‌ها

فایل‌ها و خروجی‌ها

دو راه برای دانلود خروجی مدل‌ها: GET /v1/assets/{id} نسخهٔ آینه‌شده روی سرور هرمز را می‌دهد (پیشنهادی، ۷ روز نگهداری، دانلود سریع از داخل ایران) و GET /v1/files/proxy?url=... به‌عنوان مسیر جایگزین، فایل را از مبدأ از طریق هرمز عبور می‌دهد. فقط URL هایی پذیرفته می‌شوند که خود API در خروجی prediction برگردانده باشد.

GET/v1/files/proxyاحراز هویت Bearer

Proxy-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الزامیquerystring (uri)

HTTPS URL of a generated file, as returned in a prediction's output or urls.

نمونه

پاسخ‌ها

200

File content streamed to the client.

400

The 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: the tools array, plugins field, or model's :online suffix uses an unsupported shape. The response names the offender and links to the supported form. See the dedicated InvalidTools response 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.format value 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_audio content part sent to POST /v1/responses. The Responses API has no audio content type today; resend to POST /v1/chat/completions instead.
401

Authentication 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
  }
}
403

URL is not an accepted generated-file URL.

503

The 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.

GET/v1/assets/{id}احراز هویت Bearer

Download 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الزامیpathstring (uuid)

Asset ID from the prediction's assets[] array.

نمونه

پاسخ‌ها

200

Asset file content.

401

Authentication 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
  }
}
403

This asset belongs to another account.

404

Asset not found. It may have expired (7-day retention) or the mirror worker hasn't processed it yet.

به‌روزرسانی: 2026-10-13