venice_upscale_image
Increase image resolution and quality using AI upscaling technology. Specify scale factor to enlarge images while maintaining clarity.
Instructions
Upscale an image using Venice AI
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | Base64-encoded image data or URL | |
| scale | No | Upscale factor (2, 4, etc.) |
Implementation Reference
- src/tools/inference/index.ts:92-97 (handler)Handler function that sends the image and scale to Venice AI's /images/upscale endpoint via veniceAPI, parses the response, and returns success URL or error.async ({ image, scale }) => { const response = await veniceAPI("/images/upscale", { method: "POST", body: JSON.stringify({ image, scale }) }); const data = await response.json() as ImageUpscaleResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; return { content: [{ type: "text" as const, text: data.data?.url ? `Upscaled: ${data.data.url}` : "Image upscaled" }] }; }
- src/tools/inference/index.ts:88-91 (schema)Zod schema defining the input parameters: image (string, base64 or URL), scale (number, optional default 2).{ image: z.string().describe("Base64-encoded image data or URL"), scale: z.number().optional().default(2).describe("Upscale factor (2, 4, etc.)"), },
- src/tools/inference/index.ts:85-98 (registration)Direct registration of the venice_upscale_image tool on the MCP server within registerInferenceTools.server.tool( "venice_upscale_image", "Upscale an image using Venice AI", { image: z.string().describe("Base64-encoded image data or URL"), scale: z.number().optional().default(2).describe("Upscale factor (2, 4, etc.)"), }, async ({ image, scale }) => { const response = await veniceAPI("/images/upscale", { method: "POST", body: JSON.stringify({ image, scale }) }); const data = await response.json() as ImageUpscaleResponse; if (!response.ok) return { content: [{ type: "text" as const, text: `Error: ${data.error?.message || response.statusText}` }] }; return { content: [{ type: "text" as const, text: data.data?.url ? `Upscaled: ${data.data.url}` : "Image upscaled" }] }; } );
- src/index.ts:16-16 (registration)Top-level call to registerInferenceTools which includes the venice_upscale_image tool.registerInferenceTools(server);
- src/client/venice-api.ts:9-17 (helper)Shared helper function veniceAPI that performs authenticated fetch requests to Venice AI API endpoints.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 }); }