{"openapi":"3.1.0","info":{"title":"Kilo Code API","version":"1.0.0"},"servers":[{"url":"/"}],"tags":[{"name":"Organizations"},{"name":"Usage Analytics"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"paths":{"/api/trpc/usageAnalytics.getSummary":{"get":{"operationId":"usageAnalytics_getSummary","tags":["Usage Analytics"],"summary":"Return aggregate KPI metrics","description":"Returns aggregate KPI metrics for the authenticated user or an accessible organization. Use this for summary cards and high-level totals.","security":[{"bearerAuth":[]}],"parameters":[{"name":"input","in":"query","required":true,"description":"URL-encoded JSON tRPC input payload.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"startDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"endDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"granularity":{"type":"string","enum":["hour","day","week","month"]},"costSource":{"default":"cost","type":"string","enum":["cost","market"]},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationIds":{"maxItems":1000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"personalScope":{"default":"personal-only","type":"string","enum":["personal-only","include-orgs"]},"viewAs":{"default":"self","type":"string","enum":["self","org-wide"]},"features":{"type":"array","items":{"type":"string"}},"models":{"type":"array","items":{"type":"string"}},"modes":{"type":"array","items":{"type":"string"}},"userIds":{"type":"array","items":{"type":"string"}},"providers":{"type":"array","items":{"type":"string"}},"projects":{"type":"array","items":{"type":"string"}},"excludedFeatures":{"type":"array","items":{"type":"string"}},"excludedModels":{"type":"array","items":{"type":"string"}},"excludedModes":{"type":"array","items":{"type":"string"}},"excludedUserIds":{"type":"array","items":{"type":"string"}},"excludedProviders":{"type":"array","items":{"type":"string"}},"excludedProjects":{"type":"array","items":{"type":"string"}}},"required":["startDate","endDate","granularity","costSource","personalScope","viewAs"],"additionalProperties":false}}}}],"responses":{"200":{"description":"Successful tRPC response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"data":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"costMicrodollars":{"type":"number"},"requestCount":{"type":"number"},"inputTokens":{"type":"number"},"outputTokens":{"type":"number"},"cacheWriteTokens":{"type":"number"},"cacheHitTokens":{"type":"number"},"errorCount":{"type":"number"},"cancelledCount":{"type":"number"},"freeRequestCount":{"type":"number"},"byokRequestCount":{"type":"number"},"totalLatencyMs":{"type":"number"},"totalGenerationTimeMs":{"type":"number"},"latencyCount":{"type":"number"},"generationTimeCount":{"type":"number"},"totalTokens":{"type":"number"},"distinctUsers":{"type":"number"},"errorRate":{"type":"number"},"avgLatencyMs":{"type":"number"},"avgGenerationTimeMs":{"type":"number"},"costPerRequest":{"type":"number"},"tokensPerRequest":{"type":"number"},"cacheHitRatio":{"type":"number"},"outputInputRatio":{"type":"number"},"effectiveGranularity":{"type":"string","enum":["hour","day","week","month"]}},"required":["costMicrodollars","requestCount","inputTokens","outputTokens","cacheWriteTokens","cacheHitTokens","errorCount","cancelledCount","freeRequestCount","byokRequestCount","totalLatencyMs","totalGenerationTimeMs","latencyCount","generationTimeCount","totalTokens","distinctUsers","errorRate","avgLatencyMs","avgGenerationTimeMs","costPerRequest","tokensPerRequest","cacheHitRatio","outputInputRatio","effectiveGranularity"],"additionalProperties":false}},"required":["data"],"additionalProperties":true}},"required":["result"],"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/trpc/usageAnalytics.getTimeseries":{"get":{"operationId":"usageAnalytics_getTimeseries","tags":["Usage Analytics"],"summary":"Return usage analytics grouped into time buckets","description":"Returns usage analytics grouped into time buckets. Use this for trend charts and optional split-by series views.","security":[{"bearerAuth":[]}],"parameters":[{"name":"input","in":"query","required":true,"description":"URL-encoded JSON tRPC input payload.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"startDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"endDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"granularity":{"type":"string","enum":["hour","day","week","month"]},"costSource":{"default":"cost","type":"string","enum":["cost","market"]},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationIds":{"maxItems":1000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"personalScope":{"default":"personal-only","type":"string","enum":["personal-only","include-orgs"]},"viewAs":{"default":"self","type":"string","enum":["self","org-wide"]},"features":{"type":"array","items":{"type":"string"}},"models":{"type":"array","items":{"type":"string"}},"modes":{"type":"array","items":{"type":"string"}},"userIds":{"type":"array","items":{"type":"string"}},"providers":{"type":"array","items":{"type":"string"}},"projects":{"type":"array","items":{"type":"string"}},"excludedFeatures":{"type":"array","items":{"type":"string"}},"excludedModels":{"type":"array","items":{"type":"string"}},"excludedModes":{"type":"array","items":{"type":"string"}},"excludedUserIds":{"type":"array","items":{"type":"string"}},"excludedProviders":{"type":"array","items":{"type":"string"}},"excludedProjects":{"type":"array","items":{"type":"string"}},"metric":{"type":"string","enum":["cost","requests","tokens","inputTokens","outputTokens","errorRate","avgLatencyMs","avgGenerationTimeMs","costPerRequest","tokensPerRequest","cacheHitRatio","outputInputRatio"]},"splitBy":{"type":"string","enum":["feature","model","mode","user","provider","project"]}},"required":["startDate","endDate","granularity","costSource","personalScope","viewAs","metric"],"additionalProperties":false}}}}],"responses":{"200":{"description":"Successful tRPC response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"data":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"timeseries":{"type":"array","items":{"type":"object","properties":{"datetime":{"type":"string"},"value":{"type":"number"},"label":{"type":"string"}},"required":["datetime","value"],"additionalProperties":false}},"effectiveGranularity":{"type":"string","enum":["hour","day","week","month"]}},"required":["timeseries","effectiveGranularity"],"additionalProperties":false}},"required":["data"],"additionalProperties":true}},"required":["result"],"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/trpc/usageAnalytics.getBreakdown":{"get":{"operationId":"usageAnalytics_getBreakdown","tags":["Usage Analytics"],"summary":"Return top usage values grouped by dimension","description":"Returns top usage values grouped by a single selected dimension. Use this for dedicated breakdown charts such as features, models, projects, or users.","security":[{"bearerAuth":[]}],"parameters":[{"name":"input","in":"query","required":true,"description":"URL-encoded JSON tRPC input payload.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"startDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"endDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"granularity":{"type":"string","enum":["hour","day","week","month"]},"costSource":{"default":"cost","type":"string","enum":["cost","market"]},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationIds":{"maxItems":1000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"personalScope":{"default":"personal-only","type":"string","enum":["personal-only","include-orgs"]},"viewAs":{"default":"self","type":"string","enum":["self","org-wide"]},"features":{"type":"array","items":{"type":"string"}},"models":{"type":"array","items":{"type":"string"}},"modes":{"type":"array","items":{"type":"string"}},"userIds":{"type":"array","items":{"type":"string"}},"providers":{"type":"array","items":{"type":"string"}},"projects":{"type":"array","items":{"type":"string"}},"excludedFeatures":{"type":"array","items":{"type":"string"}},"excludedModels":{"type":"array","items":{"type":"string"}},"excludedModes":{"type":"array","items":{"type":"string"}},"excludedUserIds":{"type":"array","items":{"type":"string"}},"excludedProviders":{"type":"array","items":{"type":"string"}},"excludedProjects":{"type":"array","items":{"type":"string"}},"dimension":{"type":"string","enum":["feature","model","mode","user","provider","project","organization"]},"metric":{"type":"string","enum":["cost","requests","tokens"]},"limit":{"default":15,"type":"integer","minimum":1,"maximum":1000}},"required":["startDate","endDate","granularity","costSource","personalScope","viewAs","dimension","metric","limit"],"additionalProperties":false}}}}],"responses":{"200":{"description":"Successful tRPC response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"data":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"breakdown":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"value":{"type":"number"},"percentage":{"type":"number"}},"required":["key","label","value","percentage"],"additionalProperties":false}},"totalValue":{"type":"number"},"effectiveGranularity":{"type":"string","enum":["hour","day","week","month"]}},"required":["breakdown","totalValue","effectiveGranularity"],"additionalProperties":false}},"required":["data"],"additionalProperties":true}},"required":["result"],"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/trpc/usageAnalytics.getTable":{"get":{"operationId":"usageAnalytics_getTable","tags":["Usage Analytics"],"summary":"Return aggregated tabular usage rows","description":"Returns aggregated tabular usage rows grouped by time bucket and optional dimensions. Use this for the detailed breakdown table and CSV export view.","security":[{"bearerAuth":[]}],"parameters":[{"name":"input","in":"query","required":true,"description":"URL-encoded JSON tRPC input payload.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"startDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"endDate":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"granularity":{"type":"string","enum":["hour","day","week","month"]},"costSource":{"default":"cost","type":"string","enum":["cost","market"]},"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"organizationIds":{"maxItems":1000,"type":"array","items":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"personalScope":{"default":"personal-only","type":"string","enum":["personal-only","include-orgs"]},"viewAs":{"default":"self","type":"string","enum":["self","org-wide"]},"features":{"type":"array","items":{"type":"string"}},"models":{"type":"array","items":{"type":"string"}},"modes":{"type":"array","items":{"type":"string"}},"userIds":{"type":"array","items":{"type":"string"}},"providers":{"type":"array","items":{"type":"string"}},"projects":{"type":"array","items":{"type":"string"}},"excludedFeatures":{"type":"array","items":{"type":"string"}},"excludedModels":{"type":"array","items":{"type":"string"}},"excludedModes":{"type":"array","items":{"type":"string"}},"excludedUserIds":{"type":"array","items":{"type":"string"}},"excludedProviders":{"type":"array","items":{"type":"string"}},"excludedProjects":{"type":"array","items":{"type":"string"}},"groupBy":{"maxItems":3,"type":"array","items":{"type":"string","enum":["feature","model","mode","user","provider","project"]}},"limit":{"default":1000,"type":"integer","minimum":1,"maximum":10000}},"required":["startDate","endDate","granularity","costSource","personalScope","viewAs","groupBy","limit"],"additionalProperties":false}}}}],"responses":{"200":{"description":"Successful tRPC response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"data":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"datetime":{"type":"string"},"dimensions":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"costMicrodollars":{"type":"number"},"requestCount":{"type":"number"},"inputTokens":{"type":"number"},"outputTokens":{"type":"number"},"cacheWriteTokens":{"type":"number"},"cacheHitTokens":{"type":"number"},"errorCount":{"type":"number"}},"required":["datetime","dimensions","costMicrodollars","requestCount","inputTokens","outputTokens","cacheWriteTokens","cacheHitTokens","errorCount"],"additionalProperties":false}},"effectiveGranularity":{"type":"string","enum":["hour","day","week","month"]}},"required":["rows","effectiveGranularity"],"additionalProperties":false}},"required":["data"],"additionalProperties":true}},"required":["result"],"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/trpc/organizations.members.listPublic":{"get":{"operationId":"organizations_members_listPublic","tags":["Organizations"],"summary":"Return organization members","description":"Returns active and invited members for an organization the authenticated user can access. Invite tokens and invite URLs are omitted from the response.","security":[{"bearerAuth":[]}],"parameters":[{"name":"input","in":"query","required":true,"description":"URL-encoded JSON tRPC input payload.","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"organizationId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["organizationId"],"additionalProperties":false}}}}],"responses":{"200":{"description":"Successful tRPC response","content":{"application/json":{"schema":{"type":"object","properties":{"result":{"type":"object","properties":{"data":{"$schema":"http://json-schema.org/draft-07/schema#","type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","billing_manager"]},"status":{"type":"string","const":"active"},"inviteDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"imageUrl":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","role","status","inviteDate"],"additionalProperties":false},{"type":"object","properties":{"email":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","billing_manager"]},"inviteDate":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string","const":"invited"},"emailStatus":{"anyOf":[{"type":"string","enum":["pending","sending","delivered","failed"]},{"type":"null"}]}},"required":["email","role","inviteDate","status","emailStatus"],"additionalProperties":false}]}}},"required":["data"],"additionalProperties":true}},"required":["result"],"additionalProperties":true}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Access denied","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Unexpected server error","content":{"application/json":{"schema":{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"number"},"data":{"type":"object","properties":{"code":{"type":"string"},"httpStatus":{"type":"number"},"stack":{"type":"string"},"path":{"type":"string"},"zodError":{"anyOf":[{"type":"object","properties":{"formErrors":{"type":"array","items":{"type":"string"}},"fieldErrors":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["formErrors","fieldErrors"],"additionalProperties":false},{"type":"null"}]},"upstreamCode":{"type":"string"},"authRequired":{"type":"boolean"}},"required":["code","httpStatus","zodError"],"additionalProperties":{}}},"required":["message","code","data"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}}}}