{"openapi":"3.1.0","info":{"title":"AI Wallet Control API","description":"Wallet, developer applications, OAuth grants and usage.","license":{"name":"UNLICENSED","identifier":"UNLICENSED"},"version":"1.0.0"},"paths":{"/api/v1/admin/applications":{"get":{"tags":["admin"],"operationId":"get_admin_applications","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminAppRow"}}}}}}}},"/api/v1/admin/applications/{id}":{"patch":{"tags":["admin"],"summary":"Suspending an application revokes every active grant immediately.","operationId":"patch_admin_applications_id","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppStatus"}}},"required":true},"responses":{"200":{"description":""}}}},"/api/v1/admin/health":{"get":{"tags":["admin"],"operationId":"get_admin_health","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformHealth"}}}}}}},"/api/v1/admin/models":{"get":{"tags":["admin"],"operationId":"get_admin_models","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminModel"}}}}}}},"put":{"tags":["admin"],"operationId":"put_admin_models","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertModel"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminModel"}}}}}}},"/api/v1/admin/organizations":{"get":{"tags":["admin"],"operationId":"get_admin_organizations","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminOrgRow"}}}}}}}},"/api/v1/admin/providers":{"get":{"tags":["admin"],"operationId":"get_admin_providers","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{}}}}}}}},"/api/v1/admin/providers/{id}":{"patch":{"tags":["admin"],"operationId":"patch_admin_providers_id","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchProvider"}}},"required":true},"responses":{"200":{"description":""}}}},"/api/v1/admin/users":{"get":{"tags":["admin"],"operationId":"get_admin_users","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminUserRow"}}}}}}}},"/api/v1/applications":{"get":{"tags":["developer"],"operationId":"get_applications","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AppView"}}}}}}},"post":{"tags":["developer"],"operationId":"post_applications","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApp"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedApp"}}}}}}},"/api/v1/applications/{id}":{"get":{"tags":["developer"],"operationId":"get_applications_id","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppView"}}}}}},"patch":{"tags":["developer"],"operationId":"patch_applications_id","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateApp"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppView"}}}}}}},"/api/v1/applications/{id}/requests":{"get":{"tags":["developer"],"operationId":"get_applications_id_requests","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page_RequestLog"}}}}}}},"/api/v1/applications/{id}/rotate-secret":{"post":{"tags":["developer"],"operationId":"post_applications_id_rotate_secret","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotatedSecret"}}}}}}},"/api/v1/applications/{id}/usage":{"get":{"tags":["developer"],"operationId":"get_applications_id_usage","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DailyUsage"}}}}}}}},"/api/v1/applications/{id}/webhooks":{"get":{"tags":["developer"],"operationId":"get_applications_id_webhooks","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookView"}}}}}}},"post":{"tags":["developer"],"operationId":"post_applications_id_webhooks","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhook"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedWebhook"}}}}}}},"/api/v1/applications/{id}/webhooks/{webhook_id}":{"delete":{"tags":["developer"],"operationId":"delete_applications_id_webhooks_webhook_id","responses":{"204":{"description":""}}}},"/api/v1/audit":{"get":{"tags":["account"],"operationId":"get_audit","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditView"}}}}}}}},"/api/v1/chat/token":{"post":{"tags":["chat"],"summary":"Short-lived token for AI Wallet's own chat UI. Uses the same data plane\nas third parties; kept in browser memory only.","operationId":"post_chat_token","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatTokenRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatToken"}}}}}}},"/api/v1/credentials":{"get":{"tags":["wallet"],"operationId":"get_credentials","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CredentialView"}}}}}}},"post":{"tags":["wallet"],"operationId":"post_credentials","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCredential"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialView"}}}}}}},"/api/v1/credentials/{id}":{"get":{"tags":["wallet"],"operationId":"get_credentials_id","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialView"}}}}}},"delete":{"tags":["wallet"],"operationId":"delete_credentials_id","responses":{"204":{"description":""}}},"patch":{"tags":["wallet"],"operationId":"patch_credentials_id","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameCredential"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialView"}}}}}}},"/api/v1/credentials/{id}/revoke":{"post":{"tags":["wallet"],"operationId":"post_credentials_id_revoke","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialView"}}}}}}},"/api/v1/credentials/{id}/rotate":{"post":{"tags":["wallet"],"operationId":"post_credentials_id_rotate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateCredential"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialView"}}}}}}},"/api/v1/credentials/{id}/validate":{"post":{"tags":["wallet"],"operationId":"post_credentials_id_validate","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialView"}}}}}}},"/api/v1/grants":{"get":{"tags":["connected-apps"],"operationId":"get_grants","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GrantView"}}}}}}}},"/api/v1/grants/{id}":{"get":{"tags":["connected-apps"],"operationId":"get_grants_id","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantView"}}}}}}},"/api/v1/grants/{id}/policy":{"put":{"tags":["connected-apps"],"operationId":"put_grants_id_policy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateGrant"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantView"}}}}}}},"/api/v1/grants/{id}/requests":{"get":{"tags":["connected-apps"],"operationId":"get_grants_id_requests","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"1–200, default 50","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page_RequestLog"}}}}}}},"/api/v1/grants/{id}/revoke":{"post":{"tags":["connected-apps"],"operationId":"post_grants_id_revoke","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantView"}}}}}}},"/api/v1/grants/{id}/usage":{"get":{"tags":["connected-apps"],"operationId":"get_grants_id_usage","parameters":[{"name":"days","in":"query","description":"1–90, default 30","required":false,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DailyUsage"}}}}}}}},"/api/v1/me":{"get":{"tags":["account"],"operationId":"get_me","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}}}}},"/api/v1/oauth/requests/{id}":{"get":{"tags":["oauth"],"operationId":"get_oauth_requests_id","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentDetails"}}}}}}},"/api/v1/oauth/requests/{id}/approve":{"post":{"tags":["oauth"],"operationId":"post_oauth_requests_id_approve","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveConsent"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentResult"}}}}}}},"/api/v1/oauth/requests/{id}/deny":{"post":{"tags":["oauth"],"operationId":"post_oauth_requests_id_deny","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentResult"}}}}}}},"/api/v1/organizations":{"post":{"tags":["account"],"operationId":"post_organizations","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrg"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgView"}}}}}}},"/api/v1/organizations/{id}/members":{"get":{"tags":["account"],"operationId":"get_organizations_id_members","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MemberView"}}}}}}},"post":{"tags":["account"],"operationId":"post_organizations_id_members","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMember"}}},"required":true},"responses":{"201":{"description":""}}}},"/api/v1/organizations/{id}/members/{user_id}":{"delete":{"tags":["account"],"operationId":"delete_organizations_id_members_user_id","responses":{"204":{"description":""}}}},"/api/v1/providers":{"get":{"tags":["registry"],"operationId":"get_providers","responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProviderView"}}}}}}}},"/api/v1/requests":{"get":{"tags":["usage"],"operationId":"get_requests","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page_RequestLog"}}}}}}},"/api/v1/usage/summary":{"get":{"tags":["usage"],"operationId":"get_usage_summary","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageSummary"}}}}}}},"/oauth/revoke":{"post":{"tags":["oauth"],"summary":"`POST /oauth/revoke` (RFC 7009). Revoking a refresh token disconnects the\nwhole authorization; revoking an access token revokes just that token.","operationId":"post_oauth_revoke","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/RevokeRequest"}}},"required":true},"responses":{"200":{"description":""}}}},"/oauth/token":{"post":{"tags":["oauth"],"summary":"`POST /oauth/token`","operationId":"post_oauth_token","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/TokenRequest"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}}}}},"components":{"schemas":{"AddMember":{"type":"object","required":["email","role"],"properties":{"email":{"type":"string"},"role":{"type":"string"}}},"AdminAppRow":{"type":"object","required":["id","name","client_id","organization_name","status","is_first_party","active_grants","created_at"],"properties":{"active_grants":{"type":"integer","format":"int64"},"client_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"is_first_party":{"type":"boolean"},"name":{"type":"string"},"organization_name":{"type":"string"},"status":{"type":"string"}}},"AdminModel":{"type":"object","required":["id","provider_id","provider_model_id","display_name","capability","input_cost_micros_per_mtok","output_cost_micros_per_mtok","enabled"],"properties":{"capability":{"type":"string"},"context_window":{"type":["integer","null"],"format":"int32"},"display_name":{"type":"string"},"enabled":{"type":"boolean"},"id":{"type":"string","format":"uuid"},"input_cost_micros_per_mtok":{"type":"integer","format":"int64"},"max_output_tokens":{"type":["integer","null"],"format":"int32"},"output_cost_micros_per_mtok":{"type":"integer","format":"int64"},"provider_id":{"type":"string"},"provider_model_id":{"type":"string"}}},"AdminOrgRow":{"type":"object","required":["id","name","is_personal","members","applications","created_at"],"properties":{"applications":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"is_personal":{"type":"boolean"},"members":{"type":"integer","format":"int64"},"name":{"type":"string"}}},"AdminUserRow":{"type":"object","required":["id","status","is_platform_admin","credentials","active_grants","created_at"],"properties":{"active_grants":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"credentials":{"type":"integer","format":"int64"},"display_name":{"type":["string","null"]},"email":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"is_platform_admin":{"type":"boolean"},"status":{"type":"string"}}},"AppStatus":{"type":"object","required":["status"],"properties":{"status":{"type":"string"}}},"AppView":{"type":"object","required":["id","organization_id","name","client_id","client_secret_prefix","status","redirect_uris","active_grants","created_at","updated_at"],"properties":{"active_grants":{"type":"integer","format":"int64"},"client_id":{"type":"string"},"client_secret_prefix":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"description":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"logo_url":{"type":["string","null"]},"name":{"type":"string"},"organization_id":{"type":"string","format":"uuid"},"redirect_uris":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"updated_at":{"type":"string","format":"date-time"},"website_url":{"type":["string","null"]}}},"ApproveConsent":{"type":"object","required":["credential_id","capabilities"],"properties":{"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}},"credential_id":{"type":"string","format":"uuid"},"expires_in_days":{"type":["integer","null"],"format":"int64","description":"1–365 days; `null` = until revoked."},"limits":{"$ref":"#/components/schemas/Limits"},"models":{"type":"array","items":{"type":"string"},"description":"Model patterns, e.g. `openai/gpt-*`. Empty = all models of the credential's provider."}}},"AuditView":{"type":"object","required":["id","occurred_at","actor_type","action","resource_type","metadata"],"properties":{"action":{"type":"string"},"actor_type":{"type":"string"},"id":{"type":"string","format":"uuid"},"metadata":{},"occurred_at":{"type":"string","format":"date-time"},"request_id":{"type":["string","null"]},"resource_id":{"type":["string","null"]},"resource_type":{"type":"string"}}},"Bucket":{"type":"object","required":["key","requests","errors","input_tokens","output_tokens","cost_micros"],"properties":{"cost_micros":{"type":"integer","format":"int64"},"errors":{"type":"integer","format":"int64"},"input_tokens":{"type":"integer","format":"int64"},"key":{"type":"string"},"output_tokens":{"type":"integer","format":"int64"},"requests":{"type":"integer","format":"int64"}}},"Capability":{"type":"string","description":"What a grant may be used for. Also the OAuth scope vocabulary.","enum":["chat","responses","embeddings","images","audio.transcription","audio.speech"]},"ChatToken":{"type":"object","required":["access_token","expires_in","api_base_url","grant_id","provider"],"properties":{"access_token":{"type":"string"},"api_base_url":{"type":"string"},"expires_in":{"type":"integer","format":"int64"},"grant_id":{"type":"string","format":"uuid"},"provider":{"type":"string"}}},"ChatTokenRequest":{"type":"object","required":["credential_id"],"properties":{"credential_id":{"type":"string","format":"uuid"}}},"ConsentApp":{"type":"object","required":["name","organization_name","redirect_host"],"properties":{"description":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"name":{"type":"string"},"organization_name":{"type":"string"},"redirect_host":{"type":"string"},"website_url":{"type":["string","null"]}}},"ConsentCredential":{"type":"object","required":["id","provider","provider_name","display_name","status","models"],"properties":{"display_name":{"type":"string"},"id":{"type":"string","format":"uuid"},"models":{"type":"array","items":{"type":"string"}},"provider":{"type":"string"},"provider_name":{"type":"string"},"status":{"type":"string"}}},"ConsentDetails":{"type":"object","required":["application","requested_capabilities","requested_providers","requested_models","credentials","existing_grant"],"properties":{"application":{"$ref":"#/components/schemas/ConsentApp"},"credentials":{"type":"array","items":{"$ref":"#/components/schemas/ConsentCredential"}},"existing_grant":{"type":"boolean"},"requested_budget_monthly_usd":{"type":["number","null"],"format":"double"},"requested_capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}},"requested_models":{"type":"array","items":{"type":"string"}},"requested_providers":{"type":"array","items":{"type":"string"}}}},"ConsentResult":{"type":"object","required":["redirect_to"],"properties":{"redirect_to":{"type":"string"}}},"ConsumerLag":{"type":"object","required":["consumer","stream","offset","updated_at"],"properties":{"consumer":{"type":"string"},"offset":{"type":"integer","format":"int64"},"stream":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"CreateApp":{"type":"object","required":["name","redirect_uris"],"properties":{"description":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"name":{"type":"string"},"organization_id":{"type":["string","null"],"format":"uuid","description":"Defaults to the caller's personal workspace."},"redirect_uris":{"type":"array","items":{"type":"string"}},"website_url":{"type":["string","null"]}}},"CreateCredential":{"type":"object","required":["provider","display_name","api_key"],"properties":{"api_key":{"type":"string","format":"password","description":"Write-only. Encrypted immediately; never stored or returned in plaintext."},"display_name":{"type":"string"},"provider":{"type":"string"}}},"CreateOrg":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}},"CreateWebhook":{"type":"object","required":["url","event_types"],"properties":{"event_types":{"type":"array","items":{"type":"string"}},"url":{"type":"string"}}},"CreatedApp":{"allOf":[{"$ref":"#/components/schemas/AppView"},{"type":"object","required":["client_secret"],"properties":{"client_secret":{"type":"string","description":"Shown exactly once. Store it in your backend secret manager."}}}]},"CreatedWebhook":{"allOf":[{"$ref":"#/components/schemas/WebhookView"},{"type":"object","required":["secret"],"properties":{"secret":{"type":"string","description":"Signing secret, shown once. Verify `AIW-Signature` with it."}}}]},"CredentialView":{"type":"object","required":["id","provider","provider_name","display_name","fingerprint","status","active_grants","created_at","updated_at"],"properties":{"active_grants":{"type":"integer","format":"int64"},"created_at":{"type":"string","format":"date-time"},"display_name":{"type":"string"},"fingerprint":{"type":"string","description":"Non-reversible fingerprint. The secret itself is never returned."},"id":{"type":"string","format":"uuid"},"last_validated_at":{"type":["string","null"],"format":"date-time"},"provider":{"type":"string"},"provider_name":{"type":"string"},"status":{"type":"string"},"updated_at":{"type":"string","format":"date-time"},"validation_error":{"type":["string","null"]}}},"DailyUsage":{"type":"object","required":["day","requests","errors","input_tokens","output_tokens","cost_micros"],"properties":{"cost_micros":{"type":"integer","format":"int64"},"day":{"type":"string","format":"date-time"},"errors":{"type":"integer","format":"int64"},"input_tokens":{"type":"integer","format":"int64"},"output_tokens":{"type":"integer","format":"int64"},"requests":{"type":"integer","format":"int64"}}},"DayBucket":{"type":"object","required":["day","requests","errors","cost_micros"],"properties":{"cost_micros":{"type":"integer","format":"int64"},"day":{"type":"string","format":"date-time"},"errors":{"type":"integer","format":"int64"},"requests":{"type":"integer","format":"int64"}}},"ErrorBody":{"type":"object","required":["code","message","type"],"properties":{"code":{"$ref":"#/components/schemas/ErrorCode"},"message":{"type":"string"},"request_id":{"type":["string","null"]},"type":{"type":"string","description":"OpenAI SDK compatibility: `type` mirrors `code`."}}},"ErrorCode":{"type":"string","description":"Stable, public error codes. Clients and SDKs switch on these strings;\nnever rename one — add a new variant instead.","enum":["invalid_request","unauthenticated","invalid_token","token_expired","token_revoked","grant_revoked","grant_expired","forbidden","model_not_allowed","capability_not_allowed","not_found","conflict","rate_limited","budget_exceeded","provider_disabled","provider_error","provider_unavailable","provider_timeout","credential_unavailable","service_unavailable","internal","invalid_client","invalid_grant","unsupported_grant_type","invalid_scope"]},"ErrorEnvelope":{"type":"object","description":"Wire shape: `{\"error\": {\"code\", \"message\", \"request_id\"}}`.","required":["error"],"properties":{"error":{"$ref":"#/components/schemas/ErrorBody"}}},"GrantView":{"type":"object","required":["id","application_id","application_name","credential_id","credential_name","provider","status","capabilities","models","month_spend_micros","month_requests","starts_at","created_at"],"properties":{"application_id":{"type":"string","format":"uuid"},"application_logo_url":{"type":["string","null"]},"application_name":{"type":"string"},"application_website_url":{"type":["string","null"]},"capabilities":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"},"credential_id":{"type":"string","format":"uuid"},"credential_name":{"type":"string"},"daily_micros":{"type":["integer","null"],"format":"int64"},"expires_at":{"type":["string","null"],"format":"date-time"},"id":{"type":"string","format":"uuid"},"max_concurrency":{"type":["integer","null"],"format":"int32"},"models":{"type":"array","items":{"type":"string"}},"month_requests":{"type":"integer","format":"int64"},"month_spend_micros":{"type":"integer","format":"int64"},"monthly_micros":{"type":["integer","null"],"format":"int64"},"provider":{"type":"string"},"revoked_at":{"type":["string","null"],"format":"date-time"},"rpm":{"type":["integer","null"],"format":"int32"},"starts_at":{"type":"string","format":"date-time"},"status":{"type":"string"},"tpm":{"type":["integer","null"],"format":"int32"}}},"Limits":{"type":"object","properties":{"daily_usd":{"type":["number","null"],"format":"double"},"max_concurrency":{"type":["integer","null"],"format":"int32"},"monthly_usd":{"type":["number","null"],"format":"double"},"rpm":{"type":["integer","null"],"format":"int32"},"tpm":{"type":["integer","null"],"format":"int32"}}},"Me":{"type":"object","required":["id","is_platform_admin","organizations"],"properties":{"display_name":{"type":["string","null"]},"email":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"is_platform_admin":{"type":"boolean"},"organizations":{"type":"array","items":{"$ref":"#/components/schemas/OrgView"}}}},"MemberView":{"type":"object","required":["user_id","role","created_at"],"properties":{"created_at":{"type":"string","format":"date-time"},"display_name":{"type":["string","null"]},"email":{"type":["string","null"]},"role":{"type":"string"},"user_id":{"type":"string","format":"uuid"}}},"ModelView":{"type":"object","required":["id","display_name","capability","input_cost_per_mtok_usd","output_cost_per_mtok_usd"],"properties":{"capability":{"type":"string"},"context_window":{"type":["integer","null"],"format":"int32"},"display_name":{"type":"string"},"id":{"type":"string"},"input_cost_per_mtok_usd":{"type":"number","format":"double"},"output_cost_per_mtok_usd":{"type":"number","format":"double"}}},"OAuthError":{"type":"object","description":"RFC 6749 §5.2 error body (OAuth client libraries expect this shape).","required":["error","error_description"],"properties":{"error":{"type":"string"},"error_description":{"type":"string"}}},"OrgView":{"type":"object","required":["id","name","is_personal","role","member_count","created_at"],"properties":{"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"is_personal":{"type":"boolean"},"member_count":{"type":"integer","format":"int64"},"name":{"type":"string"},"role":{"type":"string"}}},"Page_RequestLog":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"type":"object","required":["request_id","grant_id","provider","model","capability","status","streaming","input_tokens","output_tokens","charged_cost_micros","latency_ms","started_at"],"properties":{"capability":{"type":"string"},"charged_cost_micros":{"type":"integer","format":"int64"},"error_code":{"type":["string","null"]},"grant_id":{"type":"string","format":"uuid"},"input_tokens":{"type":"integer","format":"int64"},"latency_ms":{"type":"integer","format":"int64"},"model":{"type":"string"},"output_tokens":{"type":"integer","format":"int64"},"provider":{"type":"string"},"request_id":{"type":"string","format":"uuid"},"started_at":{"type":"string","format":"date-time"},"status":{"type":"string"},"streaming":{"type":"boolean"},"ttft_ms":{"type":["integer","null"],"format":"int64"}}}},"next_cursor":{"type":["string","null"]}}},"PatchProvider":{"type":"object","properties":{"audio_allowed":{"type":["boolean","null"]},"chat_allowed":{"type":["boolean","null"]},"delegation_allowed":{"type":["boolean","null"]},"embeddings_allowed":{"type":["boolean","null"]},"enabled":{"type":["boolean","null"]},"images_allowed":{"type":["boolean","null"]},"supports_byok":{"type":["boolean","null"]},"supports_streaming":{"type":["boolean","null"]}}},"PlatformHealth":{"type":"object","required":["outbox_backlog","outbox_failing","consumers","queues","provider_usage_7d"],"properties":{"consumers":{"type":"array","items":{"$ref":"#/components/schemas/ConsumerLag"}},"outbox_backlog":{"type":"integer","format":"int64"},"outbox_failing":{"type":"integer","format":"int64"},"outbox_oldest_unpublished_seconds":{"type":["number","null"],"format":"double"},"provider_usage_7d":{"type":"array","items":{}},"queues":{"type":"array","items":{"$ref":"#/components/schemas/QueueDepth"}}}},"ProviderView":{"type":"object","required":["id","display_name","supports_streaming","requires_api_key","supports_byok","delegation_allowed","capabilities","models"],"properties":{"capabilities":{"type":"array","items":{"type":"string"}},"delegation_allowed":{"type":"boolean"},"display_name":{"type":"string"},"id":{"type":"string"},"models":{"type":"array","items":{"$ref":"#/components/schemas/ModelView"}},"requires_api_key":{"type":"boolean"},"supports_byok":{"type":"boolean","description":"Listed providers always accept user keys; this says whether a key\nmay also be shared with third-party applications."},"supports_streaming":{"type":"boolean"}}},"QueueDepth":{"type":"object","required":["queue"],"properties":{"consumers":{"type":["integer","null"],"format":"int32","minimum":0},"messages":{"type":["integer","null"],"format":"int32","minimum":0},"queue":{"type":"string"}}},"RenameCredential":{"type":"object","required":["display_name"],"properties":{"display_name":{"type":"string"}}},"RequestLog":{"type":"object","required":["request_id","grant_id","provider","model","capability","status","streaming","input_tokens","output_tokens","charged_cost_micros","latency_ms","started_at"],"properties":{"capability":{"type":"string"},"charged_cost_micros":{"type":"integer","format":"int64"},"error_code":{"type":["string","null"]},"grant_id":{"type":"string","format":"uuid"},"input_tokens":{"type":"integer","format":"int64"},"latency_ms":{"type":"integer","format":"int64"},"model":{"type":"string"},"output_tokens":{"type":"integer","format":"int64"},"provider":{"type":"string"},"request_id":{"type":"string","format":"uuid"},"started_at":{"type":"string","format":"date-time"},"status":{"type":"string"},"streaming":{"type":"boolean"},"ttft_ms":{"type":["integer","null"],"format":"int64"}}},"RevokeRequest":{"type":"object","required":["token"],"properties":{"client_id":{"type":["string","null"]},"client_secret":{"type":["string","null"]},"token":{"type":"string"},"token_type_hint":{"type":["string","null"],"description":"Accepted per RFC 7009; lookup is by hash across both token kinds."}}},"RotateCredential":{"type":"object","required":["api_key"],"properties":{"api_key":{"type":"string","format":"password"}}},"RotatedSecret":{"type":"object","required":["client_id","client_secret"],"properties":{"client_id":{"type":"string"},"client_secret":{"type":"string","description":"Shown exactly once. The previous secret stops working immediately."}}},"TokenRequest":{"type":"object","required":["grant_type"],"properties":{"client_id":{"type":["string","null"]},"client_secret":{"type":["string","null"]},"code":{"type":["string","null"]},"code_verifier":{"type":["string","null"]},"grant_type":{"type":"string"},"redirect_uri":{"type":["string","null"]},"refresh_token":{"type":["string","null"]}}},"TokenResponse":{"type":"object","required":["access_token","token_type","expires_in","scope","grant_id","provider"],"properties":{"access_token":{"type":"string"},"expires_in":{"type":"integer","format":"int64"},"grant_id":{"type":"string","format":"uuid"},"provider":{"type":"string"},"refresh_token":{"type":["string","null"]},"scope":{"type":"string"},"token_type":{"type":"string"}}},"UpdateApp":{"type":"object","properties":{"description":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"name":{"type":["string","null"]},"redirect_uris":{"type":["array","null"],"items":{"type":"string"}},"website_url":{"type":["string","null"]}}},"UpdateGrant":{"type":"object","required":["capabilities"],"properties":{"capabilities":{"type":"array","items":{"$ref":"#/components/schemas/Capability"}},"expires_in_days":{"type":["integer","null"],"format":"int64"},"limits":{"$ref":"#/components/schemas/Limits"},"models":{"type":"array","items":{"type":"string"}}}},"UpsertModel":{"type":"object","required":["provider_id","provider_model_id","display_name","capability","input_cost_micros_per_mtok","output_cost_micros_per_mtok","enabled"],"properties":{"capability":{"type":"string"},"context_window":{"type":["integer","null"],"format":"int32"},"display_name":{"type":"string"},"enabled":{"type":"boolean"},"input_cost_micros_per_mtok":{"type":"integer","format":"int64"},"max_output_tokens":{"type":["integer","null"],"format":"int32"},"output_cost_micros_per_mtok":{"type":"integer","format":"int64"},"provider_id":{"type":"string"},"provider_model_id":{"type":"string"}}},"UsageSummary":{"type":"object","required":["days","total_requests","total_errors","total_input_tokens","total_output_tokens","total_cost_micros","by_day","by_application","by_provider","by_model"],"properties":{"by_application":{"type":"array","items":{"$ref":"#/components/schemas/Bucket"}},"by_day":{"type":"array","items":{"$ref":"#/components/schemas/DayBucket"}},"by_model":{"type":"array","items":{"$ref":"#/components/schemas/Bucket"}},"by_provider":{"type":"array","items":{"$ref":"#/components/schemas/Bucket"}},"days":{"type":"integer","format":"int64"},"total_cost_micros":{"type":"integer","format":"int64"},"total_errors":{"type":"integer","format":"int64"},"total_input_tokens":{"type":"integer","format":"int64"},"total_output_tokens":{"type":"integer","format":"int64"},"total_requests":{"type":"integer","format":"int64"}}},"WebhookView":{"type":"object","required":["id","url","event_types","enabled","created_at"],"properties":{"created_at":{"type":"string","format":"date-time"},"enabled":{"type":"boolean"},"event_types":{"type":"array","items":{"type":"string"}},"id":{"type":"string","format":"uuid"},"url":{"type":"string"}}}}}}