npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

venice-ai-sdk-provider

v3.1.1

Published

Venice AI provider for the Vercel AI SDK

Readme

Venice Provider for the Vercel AI SDK

The Venice provider for the Vercel AI SDK connects your app to Venice's OpenAI-compatible API. Use it with generateText, streamText, structured output, and tool calling, plus image, speech, transcription, embedding, and decision models.

Requires AI SDK 7 (ai@^7). This package is ESM-only.

Setup

# npm
npm install ai@^7 venice-ai-sdk-provider zod

# bun
bun add ai@^7 venice-ai-sdk-provider zod

# pnpm
pnpm add ai@^7 venice-ai-sdk-provider zod

zod is a peer dependency. Get an API key from Venice and add it to your environment:

export VENICE_API_KEY=your-api-key-here

The default venice instance reads VENICE_API_KEY.

Quickstart

import { generateText } from 'ai';
import { venice } from 'venice-ai-sdk-provider';

const { text } = await generateText({
    model: venice('venice-uncensored-1-2'),
    prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});

console.log(text);

Streaming works the same way:

import { streamText } from 'ai';
import { venice } from 'venice-ai-sdk-provider';

const result = streamText({
    model: venice('venice-uncensored-1-2'),
    prompt: 'Explain why the sky is blue.',
});

for await (const chunk of result.textStream) {
    process.stdout.write(chunk);
}

Custom provider instance

Use createVenice to pass credentials directly or to customize the API base URL, headers, or fetch implementation:

import { createVenice } from 'venice-ai-sdk-provider';

const venice = createVenice({
    apiKey: process.env.VENICE_API_KEY,
    // baseURL: 'https://api.venice.ai/api/v1',
    // headers: { 'X-Custom-Header': 'value' },
});

const model = venice('venice-uncensored-1-2');

Models and capabilities

Model IDs are passed through unchanged, so any model in the Venice model catalog works. Select the model factory that matches the AI SDK call you are making:

| AI SDK use | Venice model factory | | --- | --- | | Text, objects, and tools | venice(modelId) | | Embeddings | venice.embeddingModel(modelId) | | Images and image editing | venice.imageModel(modelId) | | Speech | venice.speechModel(modelId) | | Transcription | venice.transcriptionModel(modelId) | | Decisions (experimental) | venice.decisionModel(modelId) |

venice(modelId) is equivalent to venice.languageModel(modelId) and venice.chatModel(modelId). The legacy /completions endpoint is not supported.

Venice-specific usage

Pass Venice options under providerOptions.venice. Options that are not part of the typed schema are forwarded to the Venice request body as-is, so newer API fields work without a provider release.

Web search and citations

import { generateText } from 'ai';
import { venice } from 'venice-ai-sdk-provider';

const result = await generateText({
    model: venice('venice-uncensored-1-2'),
    prompt: 'What are the latest developments in AI?',
    providerOptions: {
        venice: {
            veniceParameters: {
                enableWebSearch: 'auto',
                enableWebCitations: true,
            },
        },
    },
});

console.log(result.text);
console.log(result.sources);

for (const part of result.content) {
    if (part.type === 'text') {
        console.log(part.citations);
    }
}

The provider exposes Venice web-search references in two documented AI SDK forms:

  • Retrieved sources: URL source parts are available through result.sources (or step.sources, or source parts in fullStream). Duplicate URLs are emitted once as sources.
  • Text citations: references supporting the generated text are attached to the text part as part.citations. With streamText, they appear on text-end events and are preserved on text parts in the completed result.content. Unlike sources, citation entries are not deduplicated; every original Venice citation entry and index is retained.

Each citation contains its URL source and, when supplied by Venice, a citedText supporting passage. Venice does not provide generated-text offsets, so startIndex and endIndex are omitted. Inline markers such as ^1^ remain unchanged in the generated text. The raw citations remain available as result.providerMetadata?.venice?.webSearchCitations.

enableWebSearch accepts 'off', 'on', or 'auto'.

Model feature suffixes

Venice lets you enable parameters directly in the model ID. Because the model string is sent unchanged, suffixes work without extra configuration:

const result = await generateText({
    model: venice('venice-uncensored-1-2:enable_web_search=auto'),
    prompt: 'What happened in AI news today?',
});

See Model Feature Suffixes for the supported keys.

Reasoning

Control reasoning effort with reasoningEffort, or use the structured reasoning object. Support is model-dependent; see Reasoning Models.

const result = await generateText({
    model: venice('kimi-k3-1-pro'),
    prompt: 'Prove that there are infinitely many primes.',
    providerOptions: {
        venice: {
            reasoningEffort: 'high', // 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'
        },
    },
});

The AI SDK's top-level reasoning option is also mapped to Venice's reasoning_effort; provider options take precedence when both are set. Reasoning text is exposed as AI SDK reasoning parts (result.reasoning, result.reasoningText).

Structured output

Venice supports JSON Schema response formats. Enable structured outputs on the provider or per call:

import { generateText, Output } from 'ai';
import { z } from 'zod';
import { createVenice } from 'venice-ai-sdk-provider';

const venice = createVenice({
    apiKey: process.env.VENICE_API_KEY,
    supportsStructuredOutputs: true,
});

const { output } = await generateText({
    model: venice('z-ai-glm-5-3-flash'),
    output: Output.object({
        schema: z.object({
            name: z.string(),
            ingredients: z.array(z.string()),
        }),
    }),
    prompt: 'Generate a recipe for chocolate chip cookies.',
});

console.log(output);

Without supportsStructuredOutputs (or providerOptions.venice.structuredOutputs: true), the provider falls back to response_format: { type: 'json_object' } and emits a warning.

Multimodal inputs

Pass images, audio, video, and documents as AI SDK file parts. Venice routes each media type to the corresponding content type:

  • images → image content, from a URL or base64 data
  • audio → audio content, from base64 data (URLs are not supported)
  • video → video content, from a URL or base64 data
  • other documents → file content (PDF, DOCX, PPTX, XLSX, text, Markdown, CSV, JSON, source code)
import { generateText } from 'ai';
import { venice } from 'venice-ai-sdk-provider';

const result = await generateText({
    model: venice('qwen3-vl-235b-a22b'),
    messages: [
        {
            role: 'user',
            content: [
                { type: 'text', text: 'What do you see in this image?' },
                {
                    type: 'file',
                    mediaType: 'image/jpeg',
                    data: new URL('https://example.com/image.jpg'),
                    providerOptions: { venice: { imageDetail: 'high' } },
                },
            ],
        },
    ],
});

imageDetail accepts 'low', 'high', 'auto', or 'original'. Use a Uint8Array or base64 string instead of a URL for local files.

Venice parameters

The most commonly used veniceParameters are summarized below. Any other key is forwarded after converting its camelCase name to snake_case.

| Option | Type | Description | | --- | --- | --- | | enableWebSearch | 'off' \| 'on' \| 'auto' | Enable Venice web search. | | enableWebScraping | boolean | Scrape URLs in the latest user message. | | enableWebCitations | boolean | Ask the model to cite web sources inline. | | enableXSearch | boolean | Use xAI native search on supported models. | | stripThinkingResponse | boolean | Remove <think> blocks from reasoning model responses. | | disableThinking | boolean | Disable thinking on supported reasoning models. | | includeVeniceSystemPrompt | boolean | Include Venice's built-in system prompt. This provider defaults it to false; the Venice API default is true. | | characterSlug | string | Use a public Venice character persona. |

See the Venice chat completions reference for the full parameter list.

Images

Image generation and editing use Venice's native /image/generate and /image/edit endpoints:

import { generateImage } from 'ai';
import { venice } from 'venice-ai-sdk-provider';

const generated = await generateImage({
    model: venice.imageModel('qwen-image'),
    prompt: 'A serene canal in Venice at sunset',
    size: '1024x1024',
    providerOptions: {
        venice: {
            negative_prompt: 'low quality',
        },
    },
});

const edited = await generateImage({
    model: venice.imageModel('qwen-image-2-1-turbo-edit'),
    prompt: {
        images: [generated.image.uint8Array],
        text: 'Change the sunset to a sunrise',
    },
    providerOptions: {
        venice: {
            output_format: 'png',
        },
    },
});

console.log(edited.image.mediaType);
  • n maps to Venice's variants (up to 4 images per call).
  • aspectRatio takes precedence over size. Native width/height are capped at 1280px; larger size values throw. Use aspectRatio with the resolution provider option for larger images.
  • resolution is forwarded for resolution-tier models such as gpt-image-2 and nano-banana-pro, which accept 1K, 2K, or 4K. Other models, such as qwen-image, accept aspect_ratio but not resolution.
  • Image editing accepts exactly one prompt.images entry. Masks and multiple input images are not supported.

Speech, transcription, and embeddings

import { embed, generateSpeech, transcribe } from 'ai';
import { venice } from 'venice-ai-sdk-provider';

const { audio } = await generateSpeech({
    model: venice.speechModel('tts-kokoro'),
    text: 'Hello from Venice.',
    voice: 'af_sky',
});

const { text, segments, words } = await transcribe({
    model: venice.transcriptionModel('openai/whisper-large-v3'),
    audio: audioBytes,
    mediaType: 'audio/mpeg',
    timestampGranularities: ['word', 'segment'],
});

const { embedding } = await embed({
    model: venice.embeddingModel('text-embedding-bge-m3'),
    value: 'sunny day at the beach',
});

outputFormat for speech accepts mp3/mpeg, wav/wave, opus, aac, flac, and pcm/pcm16; unsupported formats fall back to mp3 with a warning. Transcription provider options are language and timestamps.

Decisions (experimental)

Venice's /decisions endpoint returns typed judgments instead of generated text:

import { experimental_decide } from 'ai';
import { venice } from 'venice-ai-sdk-provider';

const { answers } = await experimental_decide({
    model: venice.decisionModel('jev-latest'),
    state: [
        {
            type: 'text',
            text: 'My payouts have failed for three days and nobody has replied. Please help as soon as possible.',
        },
    ],
    questions: {
        urgent: {
            type: 'boolean',
            instructions: 'Does this support ticket require prompt attention?',
        },
        department: {
            type: 'choice',
            instructions: 'Which team should handle this ticket?',
            criteria: {
                billing: 'Payments, invoices, or refunds',
                technical: 'Bugs, outages, or integrations',
            },
        },
    },
});

console.log(answers.urgent, answers.department);

Use boolean, choice, and score questions. box is not supported, and maxOutputTokens and reasoning are rejected with warnings.

Learn more