Skip to content

Account

Activation, balance, top-up, keys and tier management.

Overview

Base path: https://api.infrai.cc/v1/account
Auth header: Authorization: Bearer $INFRAI_API_KEY
bash
# Call any /v1/account capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/account/... \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json"

Methods

account.balance

GET /v1/account/balance

Read the wallet balance.

Returns

{ balance_usd, currency }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/balance \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.topup

POST /v1/account/topup

Top up the wallet; returns a checkout URL to hand the user — card data never touches infrai.

Parameters

NameTypeRequiredDescription
amount_usdnumber
Required
Top-up amount in USD.
return_urlstringOptionalWhere to return after checkout.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

TopupRecord { topup_id, amount_usd, state, next_action_url? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/topup \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50, "currency": "USD", "payment_method": "stripe"}'

account.keys.list

GET /v1/account/keys/list

List the project keys on the account.

Returns

{ items: Array<{ key_id, label, scopes, created_at }> }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/keys/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.tier.upgrade

POST /v1/account/tier/upgrade

Upgrade the account to a target tier.

Parameters

NameTypeRequiredDescription
target_tierstring
Required
Tier id to upgrade to.

Returns

AccountSummary { account_id, kind, status, tier, balance_usd }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/tier/upgrade \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target": "pro"}'

account.whoami

GET /v1/account/whoami

获取当前账户概要(账户 ID、类型、状态、档位、余额)。

Returns

AccountSummary { account_id, kind, status, tier, balance_usd }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/whoami \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.usage

GET /v1/account/usage

获取本计费周期的用量汇总(消费、请求数、按能力拆分)。

Returns

UsageSummary { period, spend_usd, requests, by_capability }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/usage \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.usage.timeseries

GET /v1/account/usage/timeseries

按时间粒度获取用量时间序列。

Parameters

NameTypeRequiredDescription
startstringOptional起始时间(ISO 8601),留空则取周期起点。
endstringOptional结束时间(ISO 8601),留空则取当前。
granularity"hour" | "day" | "month"Optional聚合粒度:hour / day / month。

Returns

UsageTimeseries { granularity, points: Array<{ ts, spend_usd, requests }> }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/usage/timeseries \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.usage.forecast

GET /v1/account/usage/forecast

获取当前周期的用量与消费预测。

Returns

UsageForecast { period, projected_spend_usd, confidence }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/usage/forecast \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.usage.export

POST /v1/account/usage/export

发起用量明细导出任务,完成后提供下载链接。

Parameters

NameTypeRequiredDescription
format"csv" | "json"Optional导出格式:csv 或 json。
startstringOptional导出起始时间(ISO 8601)。
endstringOptional导出结束时间(ISO 8601)。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

UsageExport { export_id, status, download_url? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/usage/export \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.transactions.list

GET /v1/account/transactions/list

分页列出账户流水记录。

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumberOptional单页返回条数上限。

Returns

{ items: Array<Transaction>, next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/transactions/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.wallet.restore

POST /v1/account/wallet/restore

Restore wallet balance (grace-period reclaim of previously forfeited credit).

Parameters

NameTypeRequiredDescription
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

WalletRestoreResult { account_id, restored, balance_usd }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/wallet/restore \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.budget.get

GET /v1/account/budget/get

获取当前预算配置(周期、硬上限、告警阈值)。

Returns

BudgetConfig { period, hard_cap_usd?, alert_threshold_usd? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/budget/get \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.budget.set

PUT /v1/account/budget/set

设置预算:周期内消费达到硬上限即拦截,达到阈值即告警。

Parameters

NameTypeRequiredDescription
period"daily" | "monthly"
Required
预算周期:daily 或 monthly。
hard_cap_usdnumberOptional硬上限(美元),超过即拦截后续计费请求。
alert_threshold_usdnumberOptional告警阈值(美元),达到即触发告警。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

BudgetConfig { period, hard_cap_usd?, alert_threshold_usd? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PUT https://api.infrai.cc/v1/account/budget/set \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"period": "daily"}'

account.autorecharge.get

GET /v1/account/autorecharge/get

获取自动充值配置。

Returns

AutorechargeConfig { enabled, trigger_balance, recharge_amount, max_per_day, max_per_month }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/autorecharge/get \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.autorecharge.configure

PUT /v1/account/autorecharge/configure

配置自动充值:余额低于触发值时自动扣款充值。

Parameters

NameTypeRequiredDescription
trigger_balancenumber
Required
触发余额:钱包余额低于此值即自动充值。
recharge_amountnumber
Required
每次自动充值的金额(美元)。
payment_method_idstringOptional扣款支付方式 ID,留空则使用账户默认支付方式。
max_per_daynumberOptional每日自动充值次数上限(防滥用)。
max_per_monthnumberOptional每月自动充值次数上限(防滥用)。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

AutorechargeConfig { enabled, trigger_balance, recharge_amount, max_per_day, max_per_month }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PUT https://api.infrai.cc/v1/account/autorecharge/configure \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"trigger_balance": 0, "recharge_amount": 0}'

account.autorecharge.test_charge

POST /v1/account/autorecharge/test_charge

对自动充值配置发起一次测试扣款以验证支付方式可用。

Parameters

NameTypeRequiredDescription
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

TestChargeResult { ok, charged_usd?, failure_reason? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/autorecharge/test_charge \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.autorecharge.payment_failures.list

GET /v1/account/autorecharge/payment_failures/list

分页列出自动充值的扣款失败记录。

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumberOptional单页返回条数上限。

Returns

{ items: Array<PaymentFailure>, next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/autorecharge/payment_failures/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.payment_method.list

GET /v1/account/payment_method/list

列出账户已绑定的支付方式及默认项。

Returns

{ items: Array<AccountPaymentMethod>, default_id? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/payment_method/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.payment_method.set_default

POST /v1/account/payment_method/set_default

将指定支付方式设为账户默认。

Parameters

NameTypeRequiredDescription
payment_method_idstring
Required
要设为默认的支付方式 ID。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

AccountPaymentMethod { id, brand, last4, is_default }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/payment_method/set_default \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payment_method_id": "..."}'

account.invoices.list

GET /v1/account/invoices/list

分页列出账单发票。

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumberOptional单页返回条数上限。

Returns

{ items: Array<Invoice>, next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/invoices/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.invoices.get

GET /v1/account/invoices/get/{id}

获取单张发票详情(明细与 PDF 链接)。

Parameters

NameTypeRequiredDescription
invoice_idstring
Required
发票 ID。

Returns

Invoice { id, period, total_usd, status, line_items, pdf_url? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/invoices/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.tier

GET /v1/account/tier

获取当前账户档位及其额度限制。

Returns

TierInfo { tier, limits, billing_period }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/tier \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.tier.downgrade

POST /v1/account/tier/downgrade

降级账户档位(默认周期末生效,不可降至 enterprise)。

Parameters

NameTypeRequiredDescription
target"standard" | "pro"
Required
目标档位:standard 或 pro。
immediatebooleanOptional是否立即生效,否则在当前计费周期末生效。
reasonstringOptional降级原因(可选,便于回访)。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

TierInfo { tier, limits, billing_period }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/tier/downgrade \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target": "standard"}'

account.subscription.get

GET /v1/account/subscription/get

获取订阅状态(档位、当前周期结束时间、是否将取消)。

Returns

SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/subscription/get \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.subscription.cancel

POST /v1/account/subscription/cancel

取消订阅,可选择在计费周期末生效以保留剩余权益。

Parameters

NameTypeRequiredDescription
at_period_endbooleanOptional是否在计费周期末取消(保留已付周期权益)。
reasonstringOptional取消原因(可选)。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/subscription/cancel \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.subscription.retry_payment

POST /v1/account/subscription/retry_payment

重试失败的续费扣款,使订阅从逾期恢复为正常。

Parameters

NameTypeRequiredDescription
payment_method_idstringOptional本次重试使用的支付方式 ID,留空则用在档支付方式。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/subscription/retry_payment \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.members.list

GET /v1/account/members/list

分页列出账户成员。

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumberOptional单页返回条数上限。

Returns

{ items: Array<Member>, next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/members/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.members.invite

POST /v1/account/members/invite

邀请成员加入账户,发送邀请邮件,成员初始状态为已邀请。

Parameters

NameTypeRequiredDescription
emailstring
Required
被邀请人邮箱。
rolestring
Required
分配的角色(如 admin / billing-ops / kyc-ops)。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

Member { member_id, email, role, status }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/members/invite \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "...", "role": "..."}'

account.members.remove

DELETE /v1/account/members/remove/{id}

从账户中移除成员。

Parameters

NameTypeRequiredDescription
member_idstring
Required
成员 ID。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ removed: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/account/members/remove/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.projects.list

GET /v1/account/projects/list

分页列出项目。

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumberOptional单页返回条数上限。

Returns

{ items: Array<Project>, next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/projects/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.projects.create

POST /v1/account/projects/create

创建项目,可选限定作用域与元数据。

Parameters

NameTypeRequiredDescription
namestring
Required
项目名称。
scopesstring[]Optional作用域列表,留空表示全模块;显式指定则按 key_scope 限制。
metadataRecord<string, unknown>Optional自定义元数据键值对。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

Project { id, name, scopes, metadata, created_at }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/projects/create \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "..."}'

account.projects.get

GET /v1/account/projects/get/{id}

获取单个项目详情。

Parameters

NameTypeRequiredDescription
project_idstring
Required
项目 ID。

Returns

Project { id, name, scopes, metadata, created_at }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/projects/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.projects.update

PATCH /v1/account/projects/update/{id}

局部更新项目(名称、作用域、限速、元数据)。

Parameters

NameTypeRequiredDescription
project_idstring
Required
项目 ID。
namestringOptional新项目名称。
scopesstring[]Optional新作用域列表。
rate_limit_rpmnumberOptional项目每分钟请求数上限。
metadataRecord<string, unknown>Optional自定义元数据键值对。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

Project { id, name, scopes, rate_limit_rpm, metadata }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PATCH https://api.infrai.cc/v1/account/projects/update/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.projects.delete

DELETE /v1/account/projects/delete/{id}

删除项目。

Parameters

NameTypeRequiredDescription
project_idstring
Required
项目 ID。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ deleted: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/account/projects/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.keys.create

POST /v1/account/keys/create

创建 API Key,key_secret 仅在创建时返回一次。

Parameters

NameTypeRequiredDescription
project_idstringOptional归属项目 ID,留空则用调用方当前项目。
namestringOptionalKey 名称(最长 128 字符)。
scopesstring[]Optional作用域列表,留空表示全模块。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ApiKey { key_id, name, scopes, key_secret, created_at }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/keys/create \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.keys.update

PATCH /v1/account/keys/update/{id}

更新 API Key 的名称和/或作用域,作用域收紧立即生效。

Parameters

NameTypeRequiredDescription
key_idstring
Required
API Key ID。
namestringOptional新 Key 名称。
scopesstring[]Optional新作用域列表。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ApiKey { key_id, name, scopes }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PATCH https://api.infrai.cc/v1/account/keys/update/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.keys.rotate

POST /v1/account/keys/rotate/{id}

轮换 API Key:签发新密钥,旧密钥在宽限期内仍有效。

Parameters

NameTypeRequiredDescription
key_idstring
Required
API Key ID。
grace_hoursnumberOptional旧密钥宽限有效小时数(0-168,默认 24)。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ApiKey { key_id, key_secret, status, grace_expires_at }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/keys/rotate/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.keys.revoke

DELETE /v1/account/keys/revoke/{id}

吊销 API Key,立即失效。

Parameters

NameTypeRequiredDescription
key_idstring
Required
API Key ID。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ revoked: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/account/keys/revoke/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.keys.suspected_compromise

POST /v1/account/keys/suspected_compromise/{id}

上报 API Key 疑似泄露,可立即吊销并自动签发替换密钥。

Parameters

NameTypeRequiredDescription
key_idstring
Required
API Key ID。
confirmed_leakbooleanOptional是否已确认泄露,true 则立即吊销。
auto_rotatebooleanOptional是否自动签发替换密钥。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ApiKey { key_id, status, key_secret? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/keys/suspected_compromise/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.webhooks.list

GET /v1/account/webhooks/list

分页列出已注册的 Webhook。

Parameters

NameTypeRequiredDescription
cursorstringOptional分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumberOptional单页返回条数上限。

Returns

{ items: Array<Webhook>, next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/webhooks/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.webhooks.register

POST /v1/account/webhooks/register

注册 Webhook,URL 须为公网 https 端点(服务端做 SSRF 校验),secret 仅返回一次。

Parameters

NameTypeRequiredDescription
urlstring
Required
接收回调的公网 https 地址。
eventsstring[]
Required
订阅的事件类型列表。
descriptionstringOptional备注说明(可选,最长 256 字符)。
secretstringOptional自定义签名密钥,留空则自动生成。
retry_policy"default" | "aggressive"Optional重试策略:default 或 aggressive。
headersRecord<string, string>Optional每次投递附加的自定义 HTTP 头。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

Webhook { id, url, events, secret, active }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/webhooks/register \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "...", "events": []}'

account.webhooks.get

GET /v1/account/webhooks/get/{id}

获取单个 Webhook 详情。

Parameters

NameTypeRequiredDescription
webhook_idstring
Required
Webhook ID。

Returns

Webhook { id, url, events, active, retry_policy }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/webhooks/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.webhooks.update

PATCH /v1/account/webhooks/update/{id}

局部更新 Webhook,修改 URL 会重新触发 SSRF 校验。

Parameters

NameTypeRequiredDescription
webhook_idstring
Required
Webhook ID。
urlstringOptional新的公网 https 地址。
eventsstring[]Optional新的订阅事件类型列表。
descriptionstringOptional备注说明。
activebooleanOptional是否启用该 Webhook。
retry_policy"default" | "aggressive"Optional重试策略:default 或 aggressive。
headersRecord<string, string>Optional每次投递附加的自定义 HTTP 头。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

Webhook { id, url, events, active, retry_policy }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PATCH https://api.infrai.cc/v1/account/webhooks/update/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.webhooks.delete

DELETE /v1/account/webhooks/delete/{id}

删除 Webhook。

Parameters

NameTypeRequiredDescription
webhook_idstring
Required
Webhook ID。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ deleted: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/account/webhooks/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.webhooks.test

POST /v1/account/webhooks/test/{id}

向 Webhook 发送一条测试事件以验证连通性。

Parameters

NameTypeRequiredDescription
webhook_idstring
Required
Webhook ID。

Returns

WebhookDelivery { delivery_id, status_code, ok }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/webhooks/test/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.webhooks.deliveries

GET /v1/account/webhooks/deliveries/{id}

分页列出某 Webhook 的投递记录。

Parameters

NameTypeRequiredDescription
webhook_idstring
Required
Webhook ID。
cursorstringOptional分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumberOptional单页返回条数上限。

Returns

{ items: Array<WebhookDelivery>, next_cursor? }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/webhooks/deliveries/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.webhooks.retry

POST /v1/account/webhooks/retry/{id}

重试 Webhook 的失败投递。

Parameters

NameTypeRequiredDescription
webhook_idstring
Required
Webhook ID。
delivery_idstringOptional投递记录 ID,留空则重试最近一次失败投递。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

WebhookDelivery { delivery_id, status_code, ok }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/webhooks/retry/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.webhooks.replay

POST /v1/account/webhooks/replay/{id}

重放 Webhook 的历史投递(无论成功与否再发一次)。

Parameters

NameTypeRequiredDescription
webhook_idstring
Required
Webhook ID。
delivery_idstringOptional要重放的投递记录 ID。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

WebhookDelivery { delivery_id, status_code, ok }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/webhooks/replay/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.routing.get

GET /v1/account/routing/get

获取账户级路由配置(链路覆盖、故障转移策略、固定厂商)。

Returns

RoutingConfig { chain_override?, failover_policy, pinned_vendors }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/routing/get \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.routing.set

PUT /v1/account/routing/set

设置账户级路由:覆盖默认厂商链路、固定指定厂商。

Parameters

NameTypeRequiredDescription
chain_overridestring[]Optional厂商优先级链路覆盖列表。
pinned_vendorsstring[]Optional固定使用的厂商列表。

Returns

RoutingConfig { chain_override?, failover_policy, pinned_vendors }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X PUT https://api.infrai.cc/v1/account/routing/set \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"capability": "..."}'

account.routing.test

POST /v1/account/routing/test

测试路由解析:给定能力返回将选用的厂商链路。

Parameters

NameTypeRequiredDescription
capabilitystring
Required
要测试的能力 ID(如 ai.chat)。
chain_overridestring[]Optional用于本次测试的临时链路覆盖。

Returns

RoutingTestResult { capability, resolved_chain, selected_vendor }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/routing/test \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.bandwidth.quota

GET /v1/account/bandwidth/quota

获取带宽配额(周期上限、已用、剩余)。

Returns

BandwidthQuota { period, limit_bytes, used_bytes, remaining_bytes }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/bandwidth/quota \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.bandwidth.usage

GET /v1/account/bandwidth/usage

获取带宽用量(入站/出站字节数)。

Parameters

NameTypeRequiredDescription
startstringOptional统计起始时间(ISO 8601)。
endstringOptional统计结束时间(ISO 8601)。

Returns

BandwidthUsage { period, ingress_bytes, egress_bytes }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/bandwidth/usage \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.bandwidth.alerts.list

GET /v1/account/bandwidth/alerts/list

列出已配置的带宽告警。

Returns

{ items: Array<BandwidthAlert> }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X GET https://api.infrai.cc/v1/account/bandwidth/alerts/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

account.bandwidth.alerts.configure

POST /v1/account/bandwidth/alerts/configure

配置带宽告警:用量达到阈值即触发。

Parameters

NameTypeRequiredDescription
threshold_bytesnumber
Required
告警阈值(字节),用量达到即触发。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

BandwidthAlert { id, threshold_bytes, enabled }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X POST https://api.infrai.cc/v1/account/bandwidth/alerts/configure \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

account.bandwidth.alerts.delete

DELETE /v1/account/bandwidth/alerts/delete/{id}

删除带宽告警。

Parameters

NameTypeRequiredDescription
alert_idstring
Required
告警 ID。
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ deleted: boolean }

Example

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
curl -X DELETE https://api.infrai.cc/v1/account/bandwidth/alerts/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

All capabilities

Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.

CapabilityEndpointDescription
account.autorecharge.configurePUT /v1/account/autorecharge/configureConfigure automatic balance top-up when funds fall below a trigger threshold, with anti-abuse caps.
account.autorecharge.getGET /v1/account/autorecharge/getGet the current auto-recharge configuration.
account.autorecharge.payment_failures.listGET /v1/account/autorecharge/payment_failures/listList auto-recharge charge failures with pagination.
account.autorecharge.test_chargePOST /v1/account/autorecharge/test_chargeRun a test charge against the auto-recharge config to validate the payment method.
account.balanceGET /v1/account/balanceGet the account wallet balance and trial status.
account.bandwidth.alerts.configurePOST /v1/account/bandwidth/alerts/configureConfigure bandwidth usage threshold alerts.
account.bandwidth.alerts.deleteDELETE /v1/account/bandwidth/alerts/delete/{id}Delete a bandwidth alert.
account.bandwidth.alerts.listGET /v1/account/bandwidth/alerts/listList configured bandwidth alerts.
account.bandwidth.quotaGET /v1/account/bandwidth/quotaGet the bandwidth quota (limit, used, remaining).
account.bandwidth.usageGET /v1/account/bandwidth/usageGet inbound and outbound bandwidth usage.
account.budget.getGET /v1/account/budget/getGet the budget configuration (period, hard cap, alert thresholds).
account.budget.setPUT /v1/account/budget/setSet a hard budget cap and alert thresholds, blocking billable calls when exceeded.
account.invoices.getGET /v1/account/invoices/get/{id}Get a single invoice with line items and PDF.
account.invoices.listGET /v1/account/invoices/listList billing invoices with pagination.
account.keys.createPOST /v1/account/keys/createCreate an API key; the secret is returned only once.
account.keys.listGET /v1/account/keys/listList all API keys on the account and their status.
account.keys.revokeDELETE /v1/account/keys/revoke/{id}Revoke an API key, taking effect immediately.
account.keys.rotatePOST /v1/account/keys/rotate/{id}Rotate an API key; the old secret stays valid during a grace period.
account.keys.suspected_compromisePOST /v1/account/keys/suspected_compromise/{id}Report an API key as suspected compromised to immediately revoke and auto-reissue it.
account.keys.updatePATCH /v1/account/keys/update/{id}Update an API key's name or scopes; scope tightening takes effect immediately.
account.members.invitePOST /v1/account/members/inviteInvite a member with an assigned role and send an invitation email.
account.members.listGET /v1/account/members/listList account members with pagination.
account.members.removeDELETE /v1/account/members/remove/{id}Remove a member from the account.
account.payment_method.listGET /v1/account/payment_method/listList saved payment methods and the default one.
account.payment_method.set_defaultPOST /v1/account/payment_method/set_defaultSet a payment method as the account default.
account.projects.createPOST /v1/account/projects/createCreate a project with optional scopes and metadata.
account.projects.deleteDELETE /v1/account/projects/delete/{id}Delete a project.
account.projects.getGET /v1/account/projects/get/{id}Get details for a single project.
account.projects.listGET /v1/account/projects/listList projects with pagination.
account.projects.updatePATCH /v1/account/projects/update/{id}Partially update a project (name, scopes, rate limits, metadata).
account.routing.getGET /v1/account/routing/getGet the account-level routing configuration.
account.routing.setPUT /v1/account/routing/setSet account-level routing: override fallback chains and pin vendors.
account.routing.testPOST /v1/account/routing/testTest routing resolution for a capability and the vendor it selects.
account.subscription.cancelPOST /v1/account/subscription/cancelCancel the subscription, optionally at period end to retain entitlements.
account.subscription.getGET /v1/account/subscription/getGet the subscription status and billing period.
account.subscription.retry_paymentPOST /v1/account/subscription/retry_paymentRetry a failed renewal to recover the subscription from past-due state.
account.tierGET /v1/account/tierGet the current tier and its quota limits.
account.tier.downgradePOST /v1/account/tier/downgradeDowngrade the tier, taking effect at period end by default.
account.tier.upgradePOST /v1/account/tier/upgradeUpgrade the account tier (pro/team/enterprise), returning a checkout URL when payment is required.
account.topupPOST /v1/account/topupCreate a Stripe top-up session and return the hosted payment page URL.
account.transactions.listGET /v1/account/transactions/listList account transaction records with pagination.
account.usageGET /v1/account/usageSummarize usage for the current billing period: spend, request count, and a per-capability breakdown.
account.usage.exportPOST /v1/account/usage/exportStart a usage-detail export (CSV/JSON) and provide a download link on completion.
account.usage.forecastGET /v1/account/usage/forecastForecast usage and spend for the current period.
account.usage.timeseriesGET /v1/account/usage/timeseriesReturn a usage time series at hour, day, or month granularity.
account.wallet.restorePOST /v1/account/wallet/restoreRestore historical wallet balance after claiming the account across devices.
account.webhooks.deleteDELETE /v1/account/webhooks/delete/{id}Delete a webhook.
account.webhooks.deliveriesGET /v1/account/webhooks/deliveries/{id}List a webhook's delivery records with pagination.
account.webhooks.getGET /v1/account/webhooks/get/{id}Get details for a single webhook.
account.webhooks.listGET /v1/account/webhooks/listList registered webhooks with pagination.
account.webhooks.registerPOST /v1/account/webhooks/registerRegister a webhook (public HTTPS, SSRF-validated); the signing secret is returned only once.
account.webhooks.replayPOST /v1/account/webhooks/replay/{id}Replay a historical webhook delivery.
account.webhooks.retryPOST /v1/account/webhooks/retry/{id}Retry a failed webhook delivery.
account.webhooks.testPOST /v1/account/webhooks/test/{id}Send a test event to a webhook to verify connectivity.
account.webhooks.updatePATCH /v1/account/webhooks/update/{id}Partially update a webhook; changing the URL re-runs SSRF validation.
account.whoamiGET /v1/account/whoamiGet an account summary (ID, type, status, tier, balance).

End-to-end example

A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.

一次性前置(每个范例都假定已完成):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at the console: Google/GitHub gives you
# $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
# POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."
bash
# 1) Auth: every call is a raw HTTPS request to the Infrai gateway carrying
#    only your project key. No SDK, no install.
#    Get your key: sign in with Google/GitHub at the console for a project key
#    + $2 free credit (email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT,
#    POST /v1/account/topup and open the returned checkout_url.
export INFRAI_API_KEY="ifr_pk_proj_..."   # from the console


# 2) account.balance
curl -X GET https://api.infrai.cc/v1/account/balance \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 3) account.topup
curl -X POST https://api.infrai.cc/v1/account/topup \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50, "currency": "USD", "payment_method": "stripe"}'

# 4) account.keys.list
curl -X GET https://api.infrai.cc/v1/account/keys/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 5) account.tier.upgrade
curl -X POST https://api.infrai.cc/v1/account/tier/upgrade \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target": "pro"}'

# 6) account.whoami
curl -X GET https://api.infrai.cc/v1/account/whoami \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 7) account.usage
curl -X GET https://api.infrai.cc/v1/account/usage \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 8) account.usage.timeseries
curl -X GET https://api.infrai.cc/v1/account/usage/timeseries \
  -H "Authorization: Bearer $INFRAI_API_KEY"

# 9) account.usage.forecast
curl -X GET https://api.infrai.cc/v1/account/usage/forecast \
  -H "Authorization: Bearer $INFRAI_API_KEY"