Commerce AI V1

This reference does not activate production access or Live sales. Effective App pricing, permissions and the saved checkout offer version remain authoritative. AI Credits are independent of Product API quotas.

Four public V1 capabilities

CapabilityFeature KeyAPI / typeStandard Credits / unit
Text translationtext.translatePOST /v1/ai/text/translate2 / 1,000 UTF-16
Image text removalimage.remove_chinese_textPOST /v1/ai/image/jobs · remove_chinese_text1 / image
Image translationimage.replace_chinese_textPOST /v1/ai/image/jobs · replace_chinese_text2 / image
White backgroundimage.backgroundPOST /v1/ai/image/jobs · white_background1 / image

Limits and batch image processing

Limits are shared per App across API Keys and shops. Defaults: 60 task-create requests/minute, 1,200 job polls/minute and 300 metadata requests/minute in separate buckets. Up to 5 image jobs and 10 total jobs may be queued/running per App. Text jobs do not consume the image sub-limit, but share the total limit. App and operator overrides take precedence.

Prepaid protection additionally shares a configurable 5-image in-flight limit across the Developer’s prepaid Apps. The default protection period is 7 days after a top-up, with a 100 Credits / 10-minute attempt budget; payment review can also keep protection active. Reconciliation tasks retain their reservations and may occupy capacity until support resolves them.

Submit distinct processing intents with distinct X-Idempotency-Key values and retain accepted job IDs. For rejected new requests, no job or reservation exists. AI_PREPAID_SAFETY_LIMIT identifies Developer protection; RATE_LIMIT_EXCEEDED identifies App concurrency; AI_RATE_LIMIT_EXCEEDED identifies request frequency. Read error.code and error.details. Respect Retry-After/retry_after_seconds with jitter; 10 seconds is a minimum backoff, not a promise that a slot will be free. Retry the same intent with the same body and key. Poll accepted jobs with GET; do not create a replacement intent just because a job is still running.

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 10
 
{
  "error": {
    "code": "AI_PREPAID_SAFETY_LIMIT",
    "message": "Prepaid AI safety limit reached. Wait before creating another task or contact support.",
    "request_id": "req_example",
    "category": "RATE_LIMIT_ERROR",
    "details": {
      "accepted": false,
      "retryable": true,
      "scope": "developer",
      "retry_after_seconds": 10
    }
  }
}

Access and billing account

AI access must be enabled for the App. A Product API subscription or a Credits purchase does not grant AI access. Use the current App’s server-side API Key; prepaid API accounts require the product:translate scope. Never expose the Key in browser code.

Create or use the current App’s prepaid account in Developer Center → AI Enhancement. Your server can call GET /v1/ai/account with only the App API Key and save the returned shop; users do not need to copy a separate HIOBuy AI account value. This is a billing identifier, not an App ID, Workspace ID, organization Workspace or necessarily a Shopify store domain.

Discover the account with an API Key

Do not send X-Shop-Domain to discover the account. The endpoint selects the unique audited Portal prepaid account belonging to the authenticated App; supplied shop/App/workspace selectors cannot choose another account. It does not create an account, grant or consume Credits, or call a model. A zero balance returns 200; paid operations still require sufficient Credits. The response below is illustrative; always use the value returned for your Key.

GET /v1/ai/account
Host: api.hiobuy.com
Authorization: Bearer YOUR_APP_API_KEY
Accept: application/json
{
  "request_id": "req_example",
  "workspace_id": "aiw_example",
  "shop": "app-0123456789abcdef01234567.ai.hiobuy.invalid",
  "account_type": "prepaid",
  "status": "active",
  "currency": "USD",
  "credits_balance": 0
}

Save shop server-side and send the same value as X-Shop-Domain on balance reads, estimates, execution and job polling. Rediscover after changing the API Key and bind the cached account to that credential/App. Other endpoints still require an account identifier; pricing does not. This read uses the App metadata rate budget.

404 AI_ACCOUNT_NOT_FOUND: create the current App’s prepaid account in Developer Center → AI Enhancement. 409 AI_ACCOUNT_AMBIGUOUS: contact support; no account is selected. 403 AI_ACCOUNT_INACTIVE: contact support. 403 INSUFFICIENT_SCOPE: use a Key with product:translate. 403 AI_TEST_KEY_NOT_ALLOWED: test Keys cannot use live AI. App AI access restrictions still apply. Contact support@hiobuy.com with the Request ID, never your API Key.

Choose an account model for single-store and Shopify apps

One developer / one store: use one HIOBuy App, its server-side API Key and its Portal prepaid account. Query /v1/ai/account once when connecting the Key, then use the returned shop. You do not need to configure a Shopify domain in HIOBuy or enter a second account setting.

Multi-tenant Shopify SaaS, developer pays: one HIOBuy App and Key can serve multiple installations using the same discovered prepaid account. All those stores consume that account’s balance. A Shopify store domain identifies your tenant; it does not automatically create a funded wallet. Keep tenant ownership, job access and usage allocation in your backend, using the authenticated Shopify session. App rate limits are shared across tenants; discovery does not create per-tenant limits.

Multi-tenant BYOK, each merchant brings a HIOBuy Key: keep each installation’s Key encrypted on your server and discover/cache its account separately. Keys belonging to the same HIOBuy App still select the same standard prepaid account; separate Keys alone do not split billing. Different Apps select their own accounts. Never use one installation’s cached account or jobs for another installation.

Separate wallets per shop under one App: the underlying model supports independent merchant integration accounts, but this endpoint only discovers the Portal prepaid account. Existing verified merchant billing integrations retain their contract; contact HIOBuy to arrange this model. Passing an arbitrary xxx.myshopify.com to balance/estimate/execution can create a separate zero-balance account; it does not share or transfer the Portal prepaid balance and does not establish a funded merchant billing integration.

Base URL and authentication

https://api.hiobuy.com

Run requests on your server. Configure only the API Key, then fetch the billing identifier automatically (the shell example uses jq); applications can parse the same JSON response directly.

# Server-side environment only; requires curl and jq
set -euo pipefail
export HIOBUY_API_KEY='YOUR_APP_API_KEY'
HIOBUY_AI_SHOP="$(curl --fail --silent --show-error \
  'https://api.hiobuy.com/v1/ai/account' \
  --header "Authorization: Bearer $HIOBUY_API_KEY" | jq -er '.shop')"
export HIOBUY_AI_SHOP
Authorization: Bearer YOUR_APP_API_KEY
X-Shop-Domain: SHOP_RETURNED_BY_AI_ACCOUNT
X-Idempotency-Key: unique-processing-intent-001
Content-Type: application/json

Balance and effective prices

curl 'https://api.hiobuy.com/v1/ai/credits' \
  --header "Authorization: Bearer $HIOBUY_API_KEY" \
  --header "X-Shop-Domain: $HIOBUY_AI_SHOP"
 
curl 'https://api.hiobuy.com/v1/ai/credits/pricing' \
  --header "Authorization: Bearer $HIOBUY_API_KEY"

Read credits_balance from the balance response. Pricing returns rules[]: use credits and enabled, not default_credits. Availability still depends on access, scope, funds and server limits.

Estimate before execution

Estimation does not reserve Credits or invoke a model. For text, send the same texts, target language, format and scene as execution; count cannot override the true text size. For one image, use the matching Feature Key and count: 1.

POST /v1/ai/credits/estimate
Host: api.hiobuy.com
Authorization: Bearer YOUR_APP_API_KEY
X-Shop-Domain: SHOP_RETURNED_BY_AI_ACCOUNT
Content-Type: application/json
 
{
  "feature": "text.translate",
  "texts": [
    "纯棉短袖T恤",
    "白色"
  ],
  "target_language": "en",
  "format_type": "text",
  "scene": "e-commerce-title"
}
POST /v1/ai/credits/estimate
Host: api.hiobuy.com
Authorization: Bearer YOUR_APP_API_KEY
X-Shop-Domain: SHOP_RETURNED_BY_AI_ACCOUNT
Content-Type: application/json
 
{
  "feature": "image.remove_chinese_text",
  "count": 1
}

Text translation

Supply 1–50 nonempty strings. Each is trimmed; the combined length must not exceed 50,000 JavaScript UTF-16 units. Chinese characters usually count as one unit; many Emoji count as two or more. HTML uses the same trimmed source-string count, not visible text or tokens. Billing is ceil(total / 1000) × effective unit price, rounded once over the batch.

At the V1 standard price: 1–1,000 units = 2 Credits; 1,001–2,000 = 4; 2,001–3,000 = 6. Empty entries are rejected. Source language defaults to auto; format is text or html. Ecommerce scenes: e-commerce-title (default), e-commerce-description, e-commerce-chat, e-commerce-cpv.

POST /v1/ai/text/translate
Host: api.hiobuy.com
Authorization: Bearer YOUR_APP_API_KEY
X-Shop-Domain: SHOP_RETURNED_BY_AI_ACCOUNT
X-Idempotency-Key: text-translation-001
Content-Type: application/json
 
{
  "texts": [
    "纯棉短袖T恤",
    "白色"
  ],
  "source_language": "zh",
  "target_language": "en",
  "format_type": "text",
  "scene": "e-commerce-title"
}

A successful response includes job_id, character_count, translations[].translated_text (in input order), credits_used, credits_balance and request_id. Supplier translations[].characters is not the Gateway billing count. If processing is still in progress, use the error’s details.job_id to query the recorded task.

Image jobs

One image per job. Choose exactly one of the three request types below. replace_chinese_text requires target_language; white_background maps to the pricing Feature Key image.background.

POST /v1/ai/image/jobs
Host: api.hiobuy.com
Authorization: Bearer YOUR_APP_API_KEY
X-Shop-Domain: SHOP_RETURNED_BY_AI_ACCOUNT
X-Idempotency-Key: remove-image-001
Content-Type: application/json
 
{
  "type": "remove_chinese_text",
  "image_url": "https://cdn.example.com/product.jpg"
}
POST /v1/ai/image/jobs
Host: api.hiobuy.com
Authorization: Bearer YOUR_APP_API_KEY
X-Shop-Domain: SHOP_RETURNED_BY_AI_ACCOUNT
X-Idempotency-Key: translate-image-001
Content-Type: application/json
 
{
  "type": "replace_chinese_text",
  "image_url": "https://cdn.example.com/product.jpg",
  "target_language": "en"
}
POST /v1/ai/image/jobs
Host: api.hiobuy.com
Authorization: Bearer YOUR_APP_API_KEY
X-Shop-Domain: SHOP_RETURNED_BY_AI_ACCOUNT
X-Idempotency-Key: white-image-001
Content-Type: application/json
 
{
  "type": "white_background",
  "image_url": "https://cdn.example.com/product.jpg"
}

Image source and upload

image_url must be a downloadable HTTPS image on a Gateway-approved host. Local files, base64, multipart bodies and arbitrary public domains are not accepted by this endpoint. Use an approved image CDN or ask support to review your delivery host. Developer Center Playground offers a signed-in, App-scoped upload flow (JPEG/PNG/WebP, up to 5 MiB); it is not a general public API upload endpoint.

Default Gateway download limits are 10 MiB, 25,000,000 pixels, 3 redirects and 15 seconds; deployment settings may differ. A URL that opens in your browser is not proof it is approved. Replace the example URL with your own approved image URL before execution.

Query status and get the result

Creation returns 202 for a new recorded job or 200 for an idempotent replay. Neither code alone means success: inspect job.status, job.billing_state and job.error. Poll the returned job.id with the same App Key and account domain, using backoff.

# Use job.id from image creation, or job_id from text translation
curl 'https://api.hiobuy.com/v1/ai/jobs/YOUR_JOB_ID' \
  --header "Authorization: Bearer $HIOBUY_API_KEY" \
  --header "X-Shop-Domain: $HIOBUY_AI_SHOP"
FieldMeaning
job.statusPublic status: queued, running, completed, failed or refunded.
job.output.urlImage result URL after completion. Download/re-host results before saving permanent catalog URLs. Anyone with the processed asset URL can read it.
job.credits_reservedHeld Credits; this is not an additional fee on top of settlement.
job.credits_usedFinal settled consumption. While a task is running this may be zero even though Credits are held.
job.billing_stateBilling/recovery state. provider_succeeded or reconciliation can remain publicly running; do not create another paid task to recover it.
request_idRequest tracing in the existing unified Request Logs; not a separate AI log.

The job query does not include a refreshed balance: read /v1/ai/credits after settlement. GET /v1/ai/assets/{job_id}.webp is the existing public WebP asset route; normally use job.output.url. Text task recovery uses job.output.translations.

Automatic termination and safe retries

Tasks for the four public V1 capabilities, in both Developer Center prepaid accounts and Shopify merchant wallets, have at most 3 execution attempts (the first plus 2 retries) and a 10-minute window from task creation. Attempts are persistent; Queue redelivery and Cron recovery do not reset them. Temporary input-download failures retry after 10 and 30 seconds. A saved supplier result retries downstream processing only, without another model call. Invalid input can fail earlier.

An unknown supplier response without a queryable upstream task ID ends as a failure immediately, even if no supplier Request ID was returned. It is not blindly resubmitted. A known upstream task remains under reconciliation only within the same time window. After expiry, workers, authenticated polling or periodic recovery apply termination once the active worker lease ends; the window is not a promise of an exact callback time.

Terminal failures return job.status=failed, job.billing_state=refunded, job.credits_used=0 and job.error.retryable=false. Codes are AI_JOB_TIMEOUT, AI_RETRY_EXHAUSTED or AI_PROVIDER_OUTCOME_UNKNOWN. Reserved Credits are returned once; any supplier expense is borne by HIOBuy. Stop polling, show the failure and refresh /v1/ai/credits. Replaying the same intent/key returns its terminal job; an explicitly requested new operation needs a new key and can incur a new charge. Legacy-billing tasks and private integration operations retain their prior reconciliation policy.

Idempotency and errors

Persist one X-Idempotency-Key per processing intent. Network retries reuse the exact key, body and billing account. A changed body with the same key returns 409. A deliberate new operation needs a new key. Do not automatically submit a replacement task when the supplier outcome is unknown.

HTTP / codeAction
400 · IMAGE_HOST_NOT_ALLOWED / UNSAFE_IMAGE_URLCheck input and approved image host; do not retry unchanged invalid input.
401Check the App’s API Key.
402Read the balance and top up if purchasing is available.
403 · AI_ACCESS_DISABLED / AI_FEATURE_DISABLED / AI_FEATURE_NOT_PUBLICCheck App invitation, scope and feature permission. Hidden compatibility features are not enabled by purchasing Credits.
409 · AI_REQUEST_IN_PROGRESS / AI_RECONCILIATION_REQUIREDQuery the existing details.job_id; an in-progress/reconciling result is not a safe new-call signal.
429Respect retry_after_seconds and bucket; creation, polling and metadata have separate budgets.
503When accepted=false, no new reservation was accepted; retry the same intent after the indicated delay. For a recorded/unknown outcome, inspect the task instead.

Ledger and pagination

curl 'https://api.hiobuy.com/v1/ai/credits/transactions?limit=20' \
  --header "Authorization: Bearer $HIOBUY_API_KEY" \
  --header "X-Shop-Domain: $HIOBUY_AI_SHOP"
# Next page: append &before=VALUE_FROM_pagination.next_cursor

Use pagination.next_cursor as before on the next page, with the same App/account. These are raw signed ledger movements: reserve, settle and refund are not three independent usages. Follow recorded relationships; never sum absolute amounts. For the four public V1 capabilities, both prepaid and Shopify merchant wallets follow the automatic termination rules above.

Credits purchase and compatibility

V1 standard: 1 USD = 100 Credits; $10 → 1,000, $20 → 2,000, $50 → 5,000; no bonus. Available offers, TEST/LIVE environment, sales gates and the frozen order version are determined by the server. Purchase in Developer Center; this AI API reference does not add a payment or credit-grant endpoint.

This public guide and OpenAPI describe only the four V1 capabilities above. Private integration endpoints and operation types are not part of the public contract and cannot be enabled by purchasing Credits or submitting an App/shop identifier.

OpenAPI JSON

Download the public OpenAPI document for request/response schemas, errors and the four V1 capabilities.

openapi.json 

Get Support

Need integration help? Contact Developer Support at support@hiobuy.com · Response within 1–2 business days

Email support

Your privacy choices

We use required technologies to run the site. With your permission, we also measure site usage and campaign performance.

Strictly necessaryKeeps the site working and remembers your choices.Always on