API Reference

Patch the current profile

Patch the current profile. The following is this gateway’s public contract.

PATCH https://business.tu-zi.com/api/user/self
Preview guide

Paste into an AI assistant to help with integration. Documentation and examples only; no real credentials.

Preview guide

Patch the current profile

Updated · Reviewed

Endpoint and authentication

PATCH https://business.tu-zi.com/api/user/self

Transport: json

  • Use an account system token and New-Api-User (account ID), or a valid site login session.
  • Manage system tokens in account settings. Inference API keys are not substitutes; keep system tokens out of frontend code.
Authorization: Bearer YOUR_SYSTEM_TOKEN
New-Api-User: YOUR_USER_ID
Content-Type: application/json

Before calling

  • Examples use this site's address. For another gateway, replace only the site address and keep the full endpoint path.
  • Python / JavaScript read SYSTEM_TOKEN (account system token) and USER_ID (account ID) from the environment. In cURL, replace YOUR_SYSTEM_TOKEN and YOUR_USER_ID.

Constraints

  • Updates only supplied allowlisted fields.
  • Rejects unknown fields, null, an empty object and bodies above 64 KiB.
  • Cannot change role, quota, group, password or email.
  • Response follows the current-account endpoint.

Minimal request example

{
  "display_name": "API user"
}

Confirming success

Check HTTP status, the business status in the body and the required result fields. Do not rely only on HTTP 200 or the script exit code.

  • Require success=true and inspect data. Read configuration back through its retrieval endpoint after changing it.
  • Empty lists may be valid but do not prove a specific resource exists.

Body parameters

FieldTypeRequiredDescription / constraints
display_namestringNoDisplay name, 1–20 Unicode characters.
languagestringNoInterface language. Values: "zh-CN", "zh-TW", "en", "fr", "ru", "ja", "vi"
accept_unset_model_ratio_modelbooleanNoWhether to accept models without a configured ratio.
high_concurrency_enabledbooleanNoHigh-concurrency preference; does not bypass account limits.
record_ip_logbooleanNoWhether to record request IP addresses.

Response fields

FieldTypeDescription / constraints
successbooleanBusiness success; do not rely only on HTTP status.
messagestringResult or error message.
data.idintegerAccount ID, used in New-Api-User for system-token requests.
data.usernamestringUsername.
data.display_namestringDisplay name.
data.quotaintegerRemaining quota in site units.
data.used_quotaintegerConsumed quota in site units.
data.request_countintegerTotal request count.
data.groupstringAccount group.
data.settingstringJSON-encoded user settings.
data.permissionsobjectAccount permissions and configuration capabilities.
data.roleintegerAccount role value.
data.statusintegerAccount status.
data.emailstringBound email.
data.use_groupstringUsage group configuration.
data.disabled_channelsstringDisabled-channel configuration.
data.model_limits_enabledbooleanWhether account model limits are enabled.
data.model_limitsstringAccount model restriction configuration.
data.aff_codestringReferral code.
data.aff_countintegerCurrent referral count.
data.aff_history_countintegerHistorical referral count.
data.aff_quotaintegerCurrent referral quota.
data.aff_history_quotaintegerHistorical referral quota.
data.inviter_idintegerInviter ID.
data.model_call_timeout_secondsintegerModel-call timeout in seconds.
data.stripe_customerstringPayment customer identifier.
data.sidebar_modulesobject | stringSidebar module settings; preserve the returned representation.
data.admin_permissionsstring[]Effective administrative permissions; usually empty for ordinary accounts.
data.github_idstringgithub binding identifier.
data.google_idstringgoogle binding identifier.
data.discord_idstringdiscord binding identifier.
data.oidc_idstringoidc binding identifier.
data.wechat_idstringwechat binding identifier.
data.telegram_idstringtelegram binding identifier.
data.linux_do_idstringlinux_do binding identifier.

Illustrative response; some endpoints show essential fields only. Optional fields may be absent.

{
  "success": true,
  "message": "",
  "data": {
    "id": 123,
    "username": "demo",
    "display_name": "Demo",
    "quota": 500000,
    "used_quota": 0,
    "request_count": 0,
    "group": "default",
    "setting": "{}"
  }
}

Errors and retries

Check HTTP status and success. HTTP 200 alone does not guarantee success.

  • Business validation: errors may return HTTP 200 with {"success":false,"message":"..."}; some include error.code.
  • Authentication failures: may return 401/403.
  • Rate limiting: may return 429.
  • Use bounded exponential backoff for reads encountering transient errors; fix parameter, authentication, quota, or configuration failures first.
  • Do not blindly retry task creation, generation, or key mutations, to avoid duplicate billing or execution.