SiliconFlow reads the balance from the console with the browser sign-in, and checks an API key when one is set.
Data sources + fallback order
-
Console balance (browser sign-in) —
siliconflowcn.web, tried first.- SiliconFlow retired the public balance endpoint
GET /v1/user/infoon 2026-08-14 (410 {"code":20092}), but its console still reads the balance fromGET https://cloud.siliconflow.cn/biz-server/api/v1/user/info. - Connect once in Settings (“Balance from browser sign-in”): that is the only read of the
browser, the one allowed to raise the “Chrome Safe Storage” Keychain dialog. The validated
Cookie:header is kept in Runic’s own Keychain item (siliconflow[-cn]-web-session); every refresh uses that copy and never touches the browser (background reads cannot prompt, which is why reading the browser on each refresh silently failed in 2.13.1). - Auth: the browser’s
siliconflow.cncookies (must include__SF_auth.session-token), imported in the default browser order, one session per profile. X-Subject-ID: tried fromSILICONFLOW_CN_SUBJECT_ID, then any subject-looking cookie, then without it.- Reply:
{code:20000, status:true, data:{balance, chargeBalance, totalBalance, status}}, money as strings. Shown as a limit-less balance in CNY (Paid =chargeBalance, Bonus =balance) plus a credits snapshot. - A redirect to
account.siliconflow.*or 401/403 = signed out; a 200 with a non-20000 code on every subject candidate = “needs your user ID” (exportSILICONFLOW_CN_SUBJECT_ID). - Falls back to the API key only when one exists; otherwise its own error shows. The fallback tile
reads “Key active · N models · No balance:
”. - Diagnostics:
diagnostics/siliconflow-console[-cn].jsonlists the browsers checked (cookie names, never values), each request’s HTTP status, final host and reply code/message, and the failure.
- SiliconFlow retired the public balance endpoint
-
Models API (API key) —
GET https://api.siliconflow.cn/v1/models: key health only (“Key active · N models”), since no public balance API exists any more.
Credentials
Keychain
- Service:
com.sriinnu.athena.Runic.provider-credentials.v2 - Account:
siliconflow-cn-api-token
Environment variable
SILICONFLOW_CN_API_KEY
Fallback order: Keychain first, then environment.
Token store
Sources/Runic/Core/Stores/SiliconFlowCNTokenStore.swift— reads/writes/deletes the Keychain item withkSecAttrAccessibleAfterFirstUnlock, supports migration from the Data Protection keychain.
Key files
Sources/RunicCore/Providers/SiliconFlow/SiliconFlowCNProviderDescriptor.swiftSources/RunicCore/Providers/SiliconFlow/SiliconFlowUsageFetcher.swiftSources/Runic/Core/Stores/SiliconFlowCNTokenStore.swift
Read the source ↗ Checked against Runic 2.13.5 · 9730f91