docs/stepfun.md
StepFun (阶跃星辰) is a web-based provider. Usage data comes from the Step Plan rate limit API, authenticated via an Oasis-Token obtained through a username + password login flow.
Authentication — Three methods (in priority order):
GET https://platform.stepfun.com → INGRESSCOOKIEPOST …/RegisterDevice → anonymous tokenPOST …/SignInByPassword → authenticated Oasis-Token
The token is cached in Keychain-backed CookieHeaderCache and reused until it expires.STEPFUN_USERNAME + STEPFUN_PASSWORD, or STEPFUN_TOKEN.Rate limit endpoint
POST https://platform.stepfun.com/api/step.openapi.devcenter.Dashboard/QueryStepPlanRateLimitCookie: Oasis-Token=<token>, Content-Type: application/jsonfive_hour_usage_left_rate — remaining fraction for the 5-hour window (e.g. 0.99781543)weekly_usage_left_rate — remaining fraction for the weekly windowfive_hour_usage_reset_time — reset timestamp (string or integer)weekly_usage_reset_time — reset timestamp (string or integer)Plan status endpoint
POST https://platform.stepfun.com/api/step.openapi.devcenter.Dashboard/GetStepPlanStatussubscription.name → plan name (e.g. "Plus", "Mini")usedPercent is computed as (1.0 - left_rate) × 100.loginMethod label in the menu card (e.g. "Plus").Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift (descriptor + web fetch strategy)Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift (login flow + HTTP client + JSON parser)Sources/CodexBarCore/Providers/StepFun/StepFunSettingsReader.swift (env var resolution)Sources/CodexBar/Providers/StepFun/StepFunProviderImplementation.swift (settings fields + activation logic)Sources/CodexBar/Providers/StepFun/StepFunSettingsStore.swift (SettingsStore extension)Tests/CodexBarTests/StepFunUsageFetcherTests.swift (22 test cases)