跳到正文

账户

激活、余额、充值、密钥与套餐管理。

概览

基础路径: https://api.infrai.cc/v1/account
鉴权头: 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"

方法

account.balance

GET /v1/account/balance

读取钱包余额。

返回

{ balance_usd, currency }

示例

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

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

为钱包充值;返回结账 URL 交给用户——卡数据从不经过 infrai。

参数

名称类型必填说明
amount_usdnumber
必填
充值金额(美元)。
return_urlstring可选结账后跳转地址。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

TopupRecord { topup_id, amount_usd, state, next_action_url? }

示例

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

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

列出账户下的项目密钥。

返回

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

示例

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

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

将账户升级到目标套餐。

参数

名称类型必填说明
target_tierstring
必填
要升级到的套餐 id。

返回

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

示例

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

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、类型、状态、档位、余额)。

返回

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

示例

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

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

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

返回

UsageSummary { period, spend_usd, requests, by_capability }

示例

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

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

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

参数

名称类型必填说明
startstring可选起始时间(ISO 8601),留空则取周期起点。
endstring可选结束时间(ISO 8601),留空则取当前。
granularity"hour" | "day" | "month"可选聚合粒度:hour / day / month。

返回

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

示例

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

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

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

返回

UsageForecast { period, projected_spend_usd, confidence }

示例

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

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

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

参数

名称类型必填说明
format"csv" | "json"可选导出格式:csv 或 json。
startstring可选导出起始时间(ISO 8601)。
endstring可选导出结束时间(ISO 8601)。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

UsageExport { export_id, status, download_url? }

示例

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

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

分页列出账户流水记录。

参数

名称类型必填说明
cursorstring可选分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumber可选单页返回条数上限。

返回

{ items: Array<Transaction>, next_cursor? }

示例

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

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

恢复钱包余额(宽限期内回补此前被没收的额度)。

参数

名称类型必填说明
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

WalletRestoreResult { account_id, restored, balance_usd }

示例

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

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

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

返回

BudgetConfig { period, hard_cap_usd?, alert_threshold_usd? }

示例

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

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

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

参数

名称类型必填说明
period"daily" | "monthly"
必填
预算周期:daily 或 monthly。
hard_cap_usdnumber可选硬上限(美元),超过即拦截后续计费请求。
alert_threshold_usdnumber可选告警阈值(美元),达到即触发告警。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

BudgetConfig { period, hard_cap_usd?, alert_threshold_usd? }

示例

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

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

获取自动充值配置。

返回

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

示例

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

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

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

参数

名称类型必填说明
trigger_balancenumber
必填
触发余额:钱包余额低于此值即自动充值。
recharge_amountnumber
必填
每次自动充值的金额(美元)。
payment_method_idstring可选扣款支付方式 ID,留空则使用账户默认支付方式。
max_per_daynumber可选每日自动充值次数上限(防滥用)。
max_per_monthnumber可选每月自动充值次数上限(防滥用)。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

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

示例

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

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

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

参数

名称类型必填说明
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

TestChargeResult { ok, charged_usd?, failure_reason? }

示例

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

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

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

参数

名称类型必填说明
cursorstring可选分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumber可选单页返回条数上限。

返回

{ items: Array<PaymentFailure>, next_cursor? }

示例

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

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

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

返回

{ items: Array<AccountPaymentMethod>, default_id? }

示例

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

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

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

参数

名称类型必填说明
payment_method_idstring
必填
要设为默认的支付方式 ID。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

AccountPaymentMethod { id, brand, last4, is_default }

示例

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

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

分页列出账单发票。

参数

名称类型必填说明
cursorstring可选分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumber可选单页返回条数上限。

返回

{ items: Array<Invoice>, next_cursor? }

示例

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

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 链接)。

参数

名称类型必填说明
invoice_idstring
必填
发票 ID。

返回

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

示例

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

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

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

返回

TierInfo { tier, limits, billing_period }

示例

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

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)。

参数

名称类型必填说明
target"standard" | "pro"
必填
目标档位:standard 或 pro。
immediateboolean可选是否立即生效,否则在当前计费周期末生效。
reasonstring可选降级原因(可选,便于回访)。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

TierInfo { tier, limits, billing_period }

示例

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

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

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

返回

SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }

示例

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

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

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

参数

名称类型必填说明
at_period_endboolean可选是否在计费周期末取消(保留已付周期权益)。
reasonstring可选取消原因(可选)。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }

示例

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

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

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

参数

名称类型必填说明
payment_method_idstring可选本次重试使用的支付方式 ID,留空则用在档支付方式。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }

示例

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

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

分页列出账户成员。

参数

名称类型必填说明
cursorstring可选分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumber可选单页返回条数上限。

返回

{ items: Array<Member>, next_cursor? }

示例

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

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

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

参数

名称类型必填说明
emailstring
必填
被邀请人邮箱。
rolestring
必填
分配的角色(如 admin / billing-ops / kyc-ops)。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

Member { member_id, email, role, status }

示例

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

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}

从账户中移除成员。

参数

名称类型必填说明
member_idstring
必填
成员 ID。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

{ removed: boolean }

示例

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

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

分页列出项目。

参数

名称类型必填说明
cursorstring可选分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumber可选单页返回条数上限。

返回

{ items: Array<Project>, next_cursor? }

示例

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

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

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

参数

名称类型必填说明
namestring
必填
项目名称。
scopesstring[]可选作用域列表,留空表示全模块;显式指定则按 key_scope 限制。
metadataRecord<string, unknown>可选自定义元数据键值对。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

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

示例

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

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}

获取单个项目详情。

参数

名称类型必填说明
project_idstring
必填
项目 ID。

返回

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

示例

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

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}

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

参数

名称类型必填说明
project_idstring
必填
项目 ID。
namestring可选新项目名称。
scopesstring[]可选新作用域列表。
rate_limit_rpmnumber可选项目每分钟请求数上限。
metadataRecord<string, unknown>可选自定义元数据键值对。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

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

示例

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

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}

删除项目。

参数

名称类型必填说明
project_idstring
必填
项目 ID。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

{ deleted: boolean }

示例

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

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 仅在创建时返回一次。

参数

名称类型必填说明
project_idstring可选归属项目 ID,留空则用调用方当前项目。
namestring可选Key 名称(最长 128 字符)。
scopesstring[]可选作用域列表,留空表示全模块。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

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

示例

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

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 的名称和/或作用域,作用域收紧立即生效。

参数

名称类型必填说明
key_idstring
必填
API Key ID。
namestring可选新 Key 名称。
scopesstring[]可选新作用域列表。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

ApiKey { key_id, name, scopes }

示例

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

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:签发新密钥,旧密钥在宽限期内仍有效。

参数

名称类型必填说明
key_idstring
必填
API Key ID。
grace_hoursnumber可选旧密钥宽限有效小时数(0-168,默认 24)。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

ApiKey { key_id, key_secret, status, grace_expires_at }

示例

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

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,立即失效。

参数

名称类型必填说明
key_idstring
必填
API Key ID。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

{ revoked: boolean }

示例

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

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 疑似泄露,可立即吊销并自动签发替换密钥。

参数

名称类型必填说明
key_idstring
必填
API Key ID。
confirmed_leakboolean可选是否已确认泄露,true 则立即吊销。
auto_rotateboolean可选是否自动签发替换密钥。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

ApiKey { key_id, status, key_secret? }

示例

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

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。

参数

名称类型必填说明
cursorstring可选分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumber可选单页返回条数上限。

返回

{ items: Array<Webhook>, next_cursor? }

示例

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

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 仅返回一次。

参数

名称类型必填说明
urlstring
必填
接收回调的公网 https 地址。
eventsstring[]
必填
订阅的事件类型列表。
descriptionstring可选备注说明(可选,最长 256 字符)。
secretstring可选自定义签名密钥,留空则自动生成。
retry_policy"default" | "aggressive"可选重试策略:default 或 aggressive。
headersRecord<string, string>可选每次投递附加的自定义 HTTP 头。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

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

示例

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

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 详情。

参数

名称类型必填说明
webhook_idstring
必填
Webhook ID。

返回

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

示例

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

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 校验。

参数

名称类型必填说明
webhook_idstring
必填
Webhook ID。
urlstring可选新的公网 https 地址。
eventsstring[]可选新的订阅事件类型列表。
descriptionstring可选备注说明。
activeboolean可选是否启用该 Webhook。
retry_policy"default" | "aggressive"可选重试策略:default 或 aggressive。
headersRecord<string, string>可选每次投递附加的自定义 HTTP 头。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

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

示例

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

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。

参数

名称类型必填说明
webhook_idstring
必填
Webhook ID。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

{ deleted: boolean }

示例

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

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 发送一条测试事件以验证连通性。

参数

名称类型必填说明
webhook_idstring
必填
Webhook ID。

返回

WebhookDelivery { delivery_id, status_code, ok }

示例

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

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 的投递记录。

参数

名称类型必填说明
webhook_idstring
必填
Webhook ID。
cursorstring可选分页游标:传入上一页返回的 next_cursor 获取下一页。
limitnumber可选单页返回条数上限。

返回

{ items: Array<WebhookDelivery>, next_cursor? }

示例

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

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 的失败投递。

参数

名称类型必填说明
webhook_idstring
必填
Webhook ID。
delivery_idstring可选投递记录 ID,留空则重试最近一次失败投递。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

WebhookDelivery { delivery_id, status_code, ok }

示例

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

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 的历史投递(无论成功与否再发一次)。

参数

名称类型必填说明
webhook_idstring
必填
Webhook ID。
delivery_idstring可选要重放的投递记录 ID。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

WebhookDelivery { delivery_id, status_code, ok }

示例

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

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

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

返回

RoutingConfig { chain_override?, failover_policy, pinned_vendors }

示例

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

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

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

参数

名称类型必填说明
chain_overridestring[]可选厂商优先级链路覆盖列表。
pinned_vendorsstring[]可选固定使用的厂商列表。

返回

RoutingConfig { chain_override?, failover_policy, pinned_vendors }

示例

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

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

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

参数

名称类型必填说明
capabilitystring
必填
要测试的能力 ID(如 ai.chat)。
chain_overridestring[]可选用于本次测试的临时链路覆盖。

返回

RoutingTestResult { capability, resolved_chain, selected_vendor }

示例

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

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

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

返回

BandwidthQuota { period, limit_bytes, used_bytes, remaining_bytes }

示例

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

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

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

参数

名称类型必填说明
startstring可选统计起始时间(ISO 8601)。
endstring可选统计结束时间(ISO 8601)。

返回

BandwidthUsage { period, ingress_bytes, egress_bytes }

示例

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

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

列出已配置的带宽告警。

返回

{ items: Array<BandwidthAlert> }

示例

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

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

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

参数

名称类型必填说明
threshold_bytesnumber
必填
告警阈值(字节),用量达到即触发。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

BandwidthAlert { id, threshold_bytes, enabled }

示例

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

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}

删除带宽告警。

参数

名称类型必填说明
alert_idstring
必填
告警 ID。
idempotency_keystring可选可选去重 key;相同重试将返回同一结果。

返回

{ deleted: boolean }

示例

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

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"

全部能力

本模块全部已路由能力——完整的对外 REST 契约。上方方法是带讲解的入门示例,此表是完整参考。

能力端点说明
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).

完整示例

本模块的生产级端到端范例:先一次性配置,再运行业务流程,尽量覆盖本模块的多数 API。

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

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"