venice_create_api_key
Generate new API keys for Venice AI to access chat, image generation, text-to-speech, and embedding capabilities with configurable permissions and limits.
Instructions
Create a new API key
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | Description for the new API key | |
| apiKeyType | No | API key type (ADMIN or INFERENCE) | INFERENCE |
| consumptionLimit | No | Optional consumption limits | |
| expiresAt | No | Optional expiration date (ISO 8601 format) |
Implementation Reference
- src/tools/admin/index.ts:40-52 (handler)Handler function that constructs the request body and calls veniceAPI to POST /api_keys, then formats the response.async ({ description, apiKeyType, consumptionLimit, expiresAt }) => { const body: Record<string, unknown> = { description, apiKeyType }; if (consumptionLimit) body.consumptionLimit = consumptionLimit; if (expiresAt) body.expiresAt = expiresAt; const response = await veniceAPI("/api_keys", { method: "POST", body: JSON.stringify(body) }); const data = await response.json() as CreateAPIKeyResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; const keyData = data.data; const secret = keyData?.apiKey || keyData?.key || "N/A"; return { content: [{ type: "text" as const, text: `Created API key "${keyData?.description}"\nID: ${keyData?.id}\nSecret: ${secret}\n\n⚠️ Save this secret - it won't be shown again!` }] }; }
- src/tools/admin/index.ts:30-39 (schema)Zod schema for input parameters: description (required), apiKeyType, consumptionLimit, expiresAt.{ description: z.string().describe("Description for the new API key"), apiKeyType: z.enum(["ADMIN", "INFERENCE"]).optional().default("INFERENCE").describe("API key type (ADMIN or INFERENCE)"), consumptionLimit: z.object({ usd: z.number().optional(), diem: z.number().optional(), vcu: z.number().optional() }).optional().describe("Optional consumption limits"), expiresAt: z.string().optional().describe("Optional expiration date (ISO 8601 format)") },
- src/tools/admin/index.ts:27-53 (registration)Registers the venice_create_api_key tool with McpServer, including schema and inline handler.server.tool( "venice_create_api_key", "Create a new API key", { description: z.string().describe("Description for the new API key"), apiKeyType: z.enum(["ADMIN", "INFERENCE"]).optional().default("INFERENCE").describe("API key type (ADMIN or INFERENCE)"), consumptionLimit: z.object({ usd: z.number().optional(), diem: z.number().optional(), vcu: z.number().optional() }).optional().describe("Optional consumption limits"), expiresAt: z.string().optional().describe("Optional expiration date (ISO 8601 format)") }, async ({ description, apiKeyType, consumptionLimit, expiresAt }) => { const body: Record<string, unknown> = { description, apiKeyType }; if (consumptionLimit) body.consumptionLimit = consumptionLimit; if (expiresAt) body.expiresAt = expiresAt; const response = await veniceAPI("/api_keys", { method: "POST", body: JSON.stringify(body) }); const data = await response.json() as CreateAPIKeyResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; const keyData = data.data; const secret = keyData?.apiKey || keyData?.key || "N/A"; return { content: [{ type: "text" as const, text: `Created API key "${keyData?.description}"\nID: ${keyData?.id}\nSecret: ${secret}\n\n⚠️ Save this secret - it won't be shown again!` }] }; } );