Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1466,8 +1466,8 @@ Get current rate limit quota status.

```typescript
const quota = await tuteliq.getQuota()
console.log('Rate limit:', quota.rate_limit, '/min')
console.log('Remaining:', quota.remaining)
console.log('Rate limit:', quota.limits.requestsPerMinute, '/min')
console.log('Remaining this minute:', quota.remaining.requestsThisMinute)
```

#### `getUsageHistory(days?)`
Expand Down
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1531,8 +1531,8 @@ export class Tuteliq {
* @example
* ```typescript
* const quota = await tuteliq.getQuota()
* console.log('Rate limit:', quota.rate_limit)
* console.log('Remaining this minute:', quota.remaining)
* console.log('Rate limit:', quota.limits.requestsPerMinute)
* console.log('Remaining this minute:', quota.remaining.requestsThisMinute)
* ```
*/
async getQuota(): Promise<UsageQuota> {
Expand Down
34 changes: 28 additions & 6 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,37 @@ export interface UsageSummary {
days_remaining: number;
}

/**
* GET /api/v1/usage/quota, as the API actually returns it.
*
* Earlier versions of this type declared flat `rate_limit` / `remaining` /
* `reset_in_seconds` fields the API never sent, so every consumer reading
* them got `undefined` (the MCP server's quota tool printed "undefined/min").
* The nested shape below is what is on the wire; `resetsInSeconds` was added
* to the API on 2026-09-21 and is absent on older deployments.
*/
export interface UsageQuota {
/** Rate limit per minute */
rate_limit: number;
/** Remaining requests this minute */
remaining: number;
/** Seconds until rate limit resets */
reset_in_seconds: number;
apiKeyId?: string;
/** Current tier */
tier: string;
limits: {
requestsPerMinute: number;
/** -1 = unlimited */
requestsPerMonth: number;
/** -1 = unlimited */
requestsPerDay: number;
};
current: {
requestsThisMinute: number;
requestsToday: number;
};
remaining: {
requestsThisMinute: number;
/** -1 = unlimited */
requestsToday: number;
};
/** Seconds until the per-minute window resets. Absent on API versions before 2026-09-21. */
resetsInSeconds?: number;
}

/** A single day's usage data. */
Expand Down
Loading