Skip to main content
Glama

venice_create_api_key

Generate API keys for Venice AI to enable access to open-source models, image generation, text-to-speech, and embeddings with configurable permissions and consumption limits.

Instructions

Create a new API key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesDescription for the new API key
apiKeyTypeNoAPI key type (ADMIN or INFERENCE)INFERENCE
consumptionLimitNoOptional consumption limits
expiresAtNoOptional expiration date (ISO 8601 format)

Implementation Reference

  • The main execution logic of the tool: constructs request body from parameters and uses veniceAPI to POST to /api_keys, handles response and returns formatted text content.
    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!` }] };
    }
  • Zod schema for input parameters to the tool.
    { 
      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)")
    },
  • Direct registration of the venice_create_api_key tool using McpServer.tool().
    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!` }] };
      }
    );
  • Reusable helper function for making authenticated API requests to Venice AI, used in 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 });
    }
  • TypeScript interface for the API response, used to type the response data in the handler.
    export interface CreateAPIKeyResponse extends VeniceAPIError {
      data?: {
        id?: string;
        apiKey?: string;
        key?: string;
        name?: string;
        description?: string;
      };
      success?: boolean;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Create a new API key' implies a write operation but doesn't specify whether this requires admin privileges, what happens if limits are exceeded, whether the key is immediately usable, or what format the response takes. For a mutation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is maximally concise - a single clear sentence that states exactly what the tool does with zero wasted words. It's front-loaded with the essential information and contains no unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool that creates security credentials, the description is inadequate. With no annotations, no output schema, and no behavioral context, an agent wouldn't understand important aspects like authentication requirements, what the response contains (e.g., does it return the actual key value?), or potential side effects. The description doesn't compensate for these gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema itself. The description adds no additional parameter information beyond what's already in the structured schema. This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and resource ('new API key'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'venice_retrieve_api_key' or explain what distinguishes creation from retrieval, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'venice_list_api_keys' or 'venice_retrieve_api_key'. There's no mention of prerequisites, permissions needed, or typical use cases for creating API keys versus other operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/georgeglarson/venice-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server