venice_get_rate_limits
Retrieve current rate limits, usage statistics, and account details to monitor API consumption and manage access effectively.
Instructions
Get current rate limits, usage, and account information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/admin/index.ts:84-94 (registration)Registration of the 'venice_get_rate_limits' tool using server.tool, including the inline handler function and empty input schema.
server.tool( "venice_get_rate_limits", "Get current rate limits, usage, and account information", {}, async () => { const response = await veniceAPI("/api_keys/rate_limits"); const data = await response.json() as RateLimitsResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; return { content: [{ type: "text" as const, text: JSON.stringify(data.data, null, 2) }] }; } ); - src/tools/admin/index.ts:88-93 (handler)The asynchronous handler function that calls the Venice API to retrieve rate limits and returns the formatted response or error.
async () => { const response = await veniceAPI("/api_keys/rate_limits"); const data = await response.json() as RateLimitsResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; return { content: [{ type: "text" as const, text: JSON.stringify(data.data, null, 2) }] }; } - src/types/api-types.ts:86-88 (schema)TypeScript interface for the RateLimitsResponse used in the tool handler for type assertion.
export interface RateLimitsResponse extends VeniceAPIError { data?: Record<string, unknown>; } - src/client/venice-api.ts:9-17 (helper)Helper function veniceAPI that makes authenticated HTTP requests to the Venice AI API, used by the tool handler.
export async function veniceAPI(endpoint: string, options: RequestInit = {}): Promise<Response> { const url = `${BASE_URL}${endpoint}`; const headers: Record<string, string> = { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json", ...(options.headers as Record<string, string> || {}), }; return fetch(url, { ...options, headers }); }