Account
Activation, balance, top-up, keys and tier management.
Overview
https://api.infrai.cc/v1/accountAuthorization: Bearer $INFRAI_API_KEY# 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
Read the wallet balance.
Returns
{ balance_usd, currency }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/balance \
-H "Authorization: Bearer $INFRAI_API_KEY"account.topup
Top up the wallet; returns a checkout URL to hand the user — card data never touches infrai.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
amount_usd | number | Required | Top-up amount in USD. |
return_url | string | Optional | Where to return after checkout. |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
TopupRecord { topup_id, amount_usd, state, next_action_url? }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
List the project keys on the account.
Returns
{ items: Array<{ key_id, label, scopes, created_at }> }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/keys/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.tier.upgrade
Upgrade the account to a target tier.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
target_tier | string | Required | Tier id to upgrade to. |
Returns
AccountSummary { account_id, kind, status, tier, balance_usd }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取当前账户概要(账户 ID、类型、状态、档位、余额)。
Returns
AccountSummary { account_id, kind, status, tier, balance_usd }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/whoami \
-H "Authorization: Bearer $INFRAI_API_KEY"account.usage
获取本计费周期的用量汇总(消费、请求数、按能力拆分)。
Returns
UsageSummary { period, spend_usd, requests, by_capability }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/usage \
-H "Authorization: Bearer $INFRAI_API_KEY"account.usage.timeseries
按时间粒度获取用量时间序列。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
start | string | Optional | 起始时间(ISO 8601),留空则取周期起点。 |
end | string | Optional | 结束时间(ISO 8601),留空则取当前。 |
granularity | "hour" | "day" | "month" | Optional | 聚合粒度:hour / day / month。 |
Returns
UsageTimeseries { granularity, points: Array<{ ts, spend_usd, requests }> }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/usage/timeseries \
-H "Authorization: Bearer $INFRAI_API_KEY"account.usage.forecast
获取当前周期的用量与消费预测。
Returns
UsageForecast { period, projected_spend_usd, confidence }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/usage/forecast \
-H "Authorization: Bearer $INFRAI_API_KEY"account.usage.export
发起用量明细导出任务,完成后提供下载链接。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
format | "csv" | "json" | Optional | 导出格式:csv 或 json。 |
start | string | Optional | 导出起始时间(ISO 8601)。 |
end | string | Optional | 导出结束时间(ISO 8601)。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
UsageExport { export_id, status, download_url? }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
分页列出账户流水记录。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标:传入上一页返回的 next_cursor 获取下一页。 |
limit | number | Optional | 单页返回条数上限。 |
Returns
{ items: Array<Transaction>, next_cursor? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/transactions/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.wallet.restore
Restore wallet balance (grace-period reclaim of previously forfeited credit).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
WalletRestoreResult { account_id, restored, balance_usd }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取当前预算配置(周期、硬上限、告警阈值)。
Returns
BudgetConfig { period, hard_cap_usd?, alert_threshold_usd? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/budget/get \
-H "Authorization: Bearer $INFRAI_API_KEY"account.budget.set
设置预算:周期内消费达到硬上限即拦截,达到阈值即告警。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
period | "daily" | "monthly" | Required | 预算周期:daily 或 monthly。 |
hard_cap_usd | number | Optional | 硬上限(美元),超过即拦截后续计费请求。 |
alert_threshold_usd | number | Optional | 告警阈值(美元),达到即触发告警。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
BudgetConfig { period, hard_cap_usd?, alert_threshold_usd? }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取自动充值配置。
Returns
AutorechargeConfig { enabled, trigger_balance, recharge_amount, max_per_day, max_per_month }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/autorecharge/get \
-H "Authorization: Bearer $INFRAI_API_KEY"account.autorecharge.configure
配置自动充值:余额低于触发值时自动扣款充值。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
trigger_balance | number | Required | 触发余额:钱包余额低于此值即自动充值。 |
recharge_amount | number | Required | 每次自动充值的金额(美元)。 |
payment_method_id | string | Optional | 扣款支付方式 ID,留空则使用账户默认支付方式。 |
max_per_day | number | Optional | 每日自动充值次数上限(防滥用)。 |
max_per_month | number | Optional | 每月自动充值次数上限(防滥用)。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
AutorechargeConfig { enabled, trigger_balance, recharge_amount, max_per_day, max_per_month }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
对自动充值配置发起一次测试扣款以验证支付方式可用。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
TestChargeResult { ok, charged_usd?, failure_reason? }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
分页列出自动充值的扣款失败记录。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标:传入上一页返回的 next_cursor 获取下一页。 |
limit | number | Optional | 单页返回条数上限。 |
Returns
{ items: Array<PaymentFailure>, next_cursor? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/autorecharge/payment_failures/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.payment_method.list
列出账户已绑定的支付方式及默认项。
Returns
{ items: Array<AccountPaymentMethod>, default_id? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/payment_method/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.payment_method.set_default
将指定支付方式设为账户默认。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
payment_method_id | string | Required | 要设为默认的支付方式 ID。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
AccountPaymentMethod { id, brand, last4, is_default }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
分页列出账单发票。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标:传入上一页返回的 next_cursor 获取下一页。 |
limit | number | Optional | 单页返回条数上限。 |
Returns
{ items: Array<Invoice>, next_cursor? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/invoices/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.invoices.get
获取单张发票详情(明细与 PDF 链接)。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
invoice_id | string | Required | 发票 ID。 |
Returns
Invoice { id, period, total_usd, status, line_items, pdf_url? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/invoices/get/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.tier
获取当前账户档位及其额度限制。
Returns
TierInfo { tier, limits, billing_period }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/tier \
-H "Authorization: Bearer $INFRAI_API_KEY"account.tier.downgrade
降级账户档位(默认周期末生效,不可降至 enterprise)。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
target | "standard" | "pro" | Required | 目标档位:standard 或 pro。 |
immediate | boolean | Optional | 是否立即生效,否则在当前计费周期末生效。 |
reason | string | Optional | 降级原因(可选,便于回访)。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
TierInfo { tier, limits, billing_period }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取订阅状态(档位、当前周期结束时间、是否将取消)。
Returns
SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/subscription/get \
-H "Authorization: Bearer $INFRAI_API_KEY"account.subscription.cancel
取消订阅,可选择在计费周期末生效以保留剩余权益。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
at_period_end | boolean | Optional | 是否在计费周期末取消(保留已付周期权益)。 |
reason | string | Optional | 取消原因(可选)。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
重试失败的续费扣款,使订阅从逾期恢复为正常。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
payment_method_id | string | Optional | 本次重试使用的支付方式 ID,留空则用在档支付方式。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
SubscriptionInfo { status, tier, current_period_end, cancel_at_period_end }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
分页列出账户成员。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标:传入上一页返回的 next_cursor 获取下一页。 |
limit | number | Optional | 单页返回条数上限。 |
Returns
{ items: Array<Member>, next_cursor? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/members/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.members.invite
邀请成员加入账户,发送邀请邮件,成员初始状态为已邀请。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
email | string | Required | 被邀请人邮箱。 |
role | string | Required | 分配的角色(如 admin / billing-ops / kyc-ops)。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
Member { member_id, email, role, status }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
从账户中移除成员。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
member_id | string | Required | 成员 ID。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
{ removed: boolean }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X DELETE https://api.infrai.cc/v1/account/members/remove/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.projects.list
分页列出项目。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标:传入上一页返回的 next_cursor 获取下一页。 |
limit | number | Optional | 单页返回条数上限。 |
Returns
{ items: Array<Project>, next_cursor? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/projects/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.projects.create
创建项目,可选限定作用域与元数据。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | 项目名称。 |
scopes | string[] | Optional | 作用域列表,留空表示全模块;显式指定则按 key_scope 限制。 |
metadata | Record<string, unknown> | Optional | 自定义元数据键值对。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
Project { id, name, scopes, metadata, created_at }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取单个项目详情。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | Required | 项目 ID。 |
Returns
Project { id, name, scopes, metadata, created_at }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/projects/get/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.projects.update
局部更新项目(名称、作用域、限速、元数据)。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | Required | 项目 ID。 |
name | string | Optional | 新项目名称。 |
scopes | string[] | Optional | 新作用域列表。 |
rate_limit_rpm | number | Optional | 项目每分钟请求数上限。 |
metadata | Record<string, unknown> | Optional | 自定义元数据键值对。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
Project { id, name, scopes, rate_limit_rpm, metadata }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
删除项目。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | Required | 项目 ID。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
{ deleted: boolean }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X DELETE https://api.infrai.cc/v1/account/projects/delete/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.keys.create
创建 API Key,key_secret 仅在创建时返回一次。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
project_id | string | Optional | 归属项目 ID,留空则用调用方当前项目。 |
name | string | Optional | Key 名称(最长 128 字符)。 |
scopes | string[] | Optional | 作用域列表,留空表示全模块。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
ApiKey { key_id, name, scopes, key_secret, created_at }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
更新 API Key 的名称和/或作用域,作用域收紧立即生效。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key_id | string | Required | API Key ID。 |
name | string | Optional | 新 Key 名称。 |
scopes | string[] | Optional | 新作用域列表。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
ApiKey { key_id, name, scopes }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
轮换 API Key:签发新密钥,旧密钥在宽限期内仍有效。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key_id | string | Required | API Key ID。 |
grace_hours | number | Optional | 旧密钥宽限有效小时数(0-168,默认 24)。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
ApiKey { key_id, key_secret, status, grace_expires_at }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
吊销 API Key,立即失效。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key_id | string | Required | API Key ID。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
{ revoked: boolean }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X DELETE https://api.infrai.cc/v1/account/keys/revoke/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.keys.suspected_compromise
上报 API Key 疑似泄露,可立即吊销并自动签发替换密钥。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
key_id | string | Required | API Key ID。 |
confirmed_leak | boolean | Optional | 是否已确认泄露,true 则立即吊销。 |
auto_rotate | boolean | Optional | 是否自动签发替换密钥。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
ApiKey { key_id, status, key_secret? }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
分页列出已注册的 Webhook。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
cursor | string | Optional | 分页游标:传入上一页返回的 next_cursor 获取下一页。 |
limit | number | Optional | 单页返回条数上限。 |
Returns
{ items: Array<Webhook>, next_cursor? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/webhooks/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.webhooks.register
注册 Webhook,URL 须为公网 https 端点(服务端做 SSRF 校验),secret 仅返回一次。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Required | 接收回调的公网 https 地址。 |
events | string[] | Required | 订阅的事件类型列表。 |
description | string | Optional | 备注说明(可选,最长 256 字符)。 |
secret | string | Optional | 自定义签名密钥,留空则自动生成。 |
retry_policy | "default" | "aggressive" | Optional | 重试策略:default 或 aggressive。 |
headers | Record<string, string> | Optional | 每次投递附加的自定义 HTTP 头。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
Webhook { id, url, events, secret, active }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取单个 Webhook 详情。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id | string | Required | Webhook ID。 |
Returns
Webhook { id, url, events, active, retry_policy }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/webhooks/get/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.webhooks.update
局部更新 Webhook,修改 URL 会重新触发 SSRF 校验。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id | string | Required | Webhook ID。 |
url | string | Optional | 新的公网 https 地址。 |
events | string[] | Optional | 新的订阅事件类型列表。 |
description | string | Optional | 备注说明。 |
active | boolean | Optional | 是否启用该 Webhook。 |
retry_policy | "default" | "aggressive" | Optional | 重试策略:default 或 aggressive。 |
headers | Record<string, string> | Optional | 每次投递附加的自定义 HTTP 头。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
Webhook { id, url, events, active, retry_policy }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
删除 Webhook。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id | string | Required | Webhook ID。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
{ deleted: boolean }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X DELETE https://api.infrai.cc/v1/account/webhooks/delete/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.webhooks.test
向 Webhook 发送一条测试事件以验证连通性。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id | string | Required | Webhook ID。 |
Returns
WebhookDelivery { delivery_id, status_code, ok }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
分页列出某 Webhook 的投递记录。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id | string | Required | Webhook ID。 |
cursor | string | Optional | 分页游标:传入上一页返回的 next_cursor 获取下一页。 |
limit | number | Optional | 单页返回条数上限。 |
Returns
{ items: Array<WebhookDelivery>, next_cursor? }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/webhooks/deliveries/ID \
-H "Authorization: Bearer $INFRAI_API_KEY"account.webhooks.retry
重试 Webhook 的失败投递。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id | string | Required | Webhook ID。 |
delivery_id | string | Optional | 投递记录 ID,留空则重试最近一次失败投递。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
WebhookDelivery { delivery_id, status_code, ok }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
重放 Webhook 的历史投递(无论成功与否再发一次)。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
webhook_id | string | Required | Webhook ID。 |
delivery_id | string | Optional | 要重放的投递记录 ID。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
WebhookDelivery { delivery_id, status_code, ok }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取账户级路由配置(链路覆盖、故障转移策略、固定厂商)。
Returns
RoutingConfig { chain_override?, failover_policy, pinned_vendors }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/routing/get \
-H "Authorization: Bearer $INFRAI_API_KEY"account.routing.set
设置账户级路由:覆盖默认厂商链路、固定指定厂商。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
chain_override | string[] | Optional | 厂商优先级链路覆盖列表。 |
pinned_vendors | string[] | Optional | 固定使用的厂商列表。 |
Returns
RoutingConfig { chain_override?, failover_policy, pinned_vendors }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
测试路由解析:给定能力返回将选用的厂商链路。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
capability | string | Required | 要测试的能力 ID(如 ai.chat)。 |
chain_override | string[] | Optional | 用于本次测试的临时链路覆盖。 |
Returns
RoutingTestResult { capability, resolved_chain, selected_vendor }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
获取带宽配额(周期上限、已用、剩余)。
Returns
BandwidthQuota { period, limit_bytes, used_bytes, remaining_bytes }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/bandwidth/quota \
-H "Authorization: Bearer $INFRAI_API_KEY"account.bandwidth.usage
获取带宽用量(入站/出站字节数)。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
start | string | Optional | 统计起始时间(ISO 8601)。 |
end | string | Optional | 统计结束时间(ISO 8601)。 |
Returns
BandwidthUsage { period, ingress_bytes, egress_bytes }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/bandwidth/usage \
-H "Authorization: Bearer $INFRAI_API_KEY"account.bandwidth.alerts.list
列出已配置的带宽告警。
Returns
{ items: Array<BandwidthAlert> }Example
一次性前置(每个范例都假定已完成):
# 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_..."curl -X GET https://api.infrai.cc/v1/account/bandwidth/alerts/list \
-H "Authorization: Bearer $INFRAI_API_KEY"account.bandwidth.alerts.configure
配置带宽告警:用量达到阈值即触发。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
threshold_bytes | number | Required | 告警阈值(字节),用量达到即触发。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
BandwidthAlert { id, threshold_bytes, enabled }Example
一次性前置(每个范例都假定已完成):
# 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_..."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
删除带宽告警。
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
alert_id | string | Required | 告警 ID。 |
idempotency_key | string | Optional | Optional dedup key; identical retries return the same result. |
Returns
{ deleted: boolean }Example
一次性前置(每个范例都假定已完成):
# 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_..."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.
| Capability | Endpoint | Description |
|---|---|---|
account.autorecharge.configure | PUT /v1/account/autorecharge/configure | Configure automatic balance top-up when funds fall below a trigger threshold, with anti-abuse caps. |
account.autorecharge.get | GET /v1/account/autorecharge/get | Get the current auto-recharge configuration. |
account.autorecharge.payment_failures.list | GET /v1/account/autorecharge/payment_failures/list | List auto-recharge charge failures with pagination. |
account.autorecharge.test_charge | POST /v1/account/autorecharge/test_charge | Run a test charge against the auto-recharge config to validate the payment method. |
account.balance | GET /v1/account/balance | Get the account wallet balance and trial status. |
account.bandwidth.alerts.configure | POST /v1/account/bandwidth/alerts/configure | Configure bandwidth usage threshold alerts. |
account.bandwidth.alerts.delete | DELETE /v1/account/bandwidth/alerts/delete/{id} | Delete a bandwidth alert. |
account.bandwidth.alerts.list | GET /v1/account/bandwidth/alerts/list | List configured bandwidth alerts. |
account.bandwidth.quota | GET /v1/account/bandwidth/quota | Get the bandwidth quota (limit, used, remaining). |
account.bandwidth.usage | GET /v1/account/bandwidth/usage | Get inbound and outbound bandwidth usage. |
account.budget.get | GET /v1/account/budget/get | Get the budget configuration (period, hard cap, alert thresholds). |
account.budget.set | PUT /v1/account/budget/set | Set a hard budget cap and alert thresholds, blocking billable calls when exceeded. |
account.invoices.get | GET /v1/account/invoices/get/{id} | Get a single invoice with line items and PDF. |
account.invoices.list | GET /v1/account/invoices/list | List billing invoices with pagination. |
account.keys.create | POST /v1/account/keys/create | Create an API key; the secret is returned only once. |
account.keys.list | GET /v1/account/keys/list | List all API keys on the account and their status. |
account.keys.revoke | DELETE /v1/account/keys/revoke/{id} | Revoke an API key, taking effect immediately. |
account.keys.rotate | POST /v1/account/keys/rotate/{id} | Rotate an API key; the old secret stays valid during a grace period. |
account.keys.suspected_compromise | POST /v1/account/keys/suspected_compromise/{id} | Report an API key as suspected compromised to immediately revoke and auto-reissue it. |
account.keys.update | PATCH /v1/account/keys/update/{id} | Update an API key's name or scopes; scope tightening takes effect immediately. |
account.members.invite | POST /v1/account/members/invite | Invite a member with an assigned role and send an invitation email. |
account.members.list | GET /v1/account/members/list | List account members with pagination. |
account.members.remove | DELETE /v1/account/members/remove/{id} | Remove a member from the account. |
account.payment_method.list | GET /v1/account/payment_method/list | List saved payment methods and the default one. |
account.payment_method.set_default | POST /v1/account/payment_method/set_default | Set a payment method as the account default. |
account.projects.create | POST /v1/account/projects/create | Create a project with optional scopes and metadata. |
account.projects.delete | DELETE /v1/account/projects/delete/{id} | Delete a project. |
account.projects.get | GET /v1/account/projects/get/{id} | Get details for a single project. |
account.projects.list | GET /v1/account/projects/list | List projects with pagination. |
account.projects.update | PATCH /v1/account/projects/update/{id} | Partially update a project (name, scopes, rate limits, metadata). |
account.routing.get | GET /v1/account/routing/get | Get the account-level routing configuration. |
account.routing.set | PUT /v1/account/routing/set | Set account-level routing: override fallback chains and pin vendors. |
account.routing.test | POST /v1/account/routing/test | Test routing resolution for a capability and the vendor it selects. |
account.subscription.cancel | POST /v1/account/subscription/cancel | Cancel the subscription, optionally at period end to retain entitlements. |
account.subscription.get | GET /v1/account/subscription/get | Get the subscription status and billing period. |
account.subscription.retry_payment | POST /v1/account/subscription/retry_payment | Retry a failed renewal to recover the subscription from past-due state. |
account.tier | GET /v1/account/tier | Get the current tier and its quota limits. |
account.tier.downgrade | POST /v1/account/tier/downgrade | Downgrade the tier, taking effect at period end by default. |
account.tier.upgrade | POST /v1/account/tier/upgrade | Upgrade the account tier (pro/team/enterprise), returning a checkout URL when payment is required. |
account.topup | POST /v1/account/topup | Create a Stripe top-up session and return the hosted payment page URL. |
account.transactions.list | GET /v1/account/transactions/list | List account transaction records with pagination. |
account.usage | GET /v1/account/usage | Summarize usage for the current billing period: spend, request count, and a per-capability breakdown. |
account.usage.export | POST /v1/account/usage/export | Start a usage-detail export (CSV/JSON) and provide a download link on completion. |
account.usage.forecast | GET /v1/account/usage/forecast | Forecast usage and spend for the current period. |
account.usage.timeseries | GET /v1/account/usage/timeseries | Return a usage time series at hour, day, or month granularity. |
account.wallet.restore | POST /v1/account/wallet/restore | Restore historical wallet balance after claiming the account across devices. |
account.webhooks.delete | DELETE /v1/account/webhooks/delete/{id} | Delete a webhook. |
account.webhooks.deliveries | GET /v1/account/webhooks/deliveries/{id} | List a webhook's delivery records with pagination. |
account.webhooks.get | GET /v1/account/webhooks/get/{id} | Get details for a single webhook. |
account.webhooks.list | GET /v1/account/webhooks/list | List registered webhooks with pagination. |
account.webhooks.register | POST /v1/account/webhooks/register | Register a webhook (public HTTPS, SSRF-validated); the signing secret is returned only once. |
account.webhooks.replay | POST /v1/account/webhooks/replay/{id} | Replay a historical webhook delivery. |
account.webhooks.retry | POST /v1/account/webhooks/retry/{id} | Retry a failed webhook delivery. |
account.webhooks.test | POST /v1/account/webhooks/test/{id} | Send a test event to a webhook to verify connectivity. |
account.webhooks.update | PATCH /v1/account/webhooks/update/{id} | Partially update a webhook; changing the URL re-runs SSRF validation. |
account.whoami | GET /v1/account/whoami | Get 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.
一次性前置(每个范例都假定已完成):
# 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_..."# 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"