venice provider — chat completions, streaming, tools, structured output, embeddings, transcription, image generation, and speech — wired to Venice’s API rather than tunneled through the OpenAI client.
If you want a raw Axum proxy instead of an agent framework, see Building a Rust LLM Gateway.
Prerequisites
- A recent stable Rust toolchain (Rig 0.42 uses edition 2024)
- Rig 0.42 or later
- A Venice API key
Setup
VENICE_BASE_URL (the provider defaults to https://api.venice.ai/api/v1):
Configure the Venice client
venice::Client::from_env() reads VENICE_API_KEY. Bring ProviderClient into scope:
Prefer
venice::Client over pointing Rig’s OpenAI client at Venice. The default openai::Client targets OpenAI’s Responses API. The Venice provider speaks /chat/completions and exposes VeniceParameters.&venice::Client from from_env(). Crate constants such as venice::QWEN3_5_9B are a starting point — confirm current IDs with GET /models.
Stream a response
stream_prompt returns a request that you .await into a stream. Use rig::agent::stream_to_stdout to print tokens as they arrive:
? after .await on stream_prompt — it yields the stream directly, not a Result.
Structured output
Use an extractor with aJsonSchema type to validate the model’s answer:
Tools
Define a tool with#[rig_tool] (included with Rig’s default derive feature). The generated type is the function name in PascalCase:
rig::tool::Tool by hand when you need custom argument types or error handling. See Rig’s tool docs.
Embeddings
dimensions field. Use embedding_model_with_ndims when you want a specific width rather than the model’s native size.
Venice-specific parameters
Pass Venice-only options throughVeniceParameters and merge them with additional_params. For example, enable built-in web search:
cost block), call raw_completion on the completion model. The normalized agent path drops those Venice-only fields:
VeniceParameters also covers character slugs, thinking controls, web scraping, X search, and whether to include Venice’s default system prompt. See the API specification for the full venice_parameters list.
Other capabilities
The samevenice::Client also drives:
- Transcription —
client.transcription_model(venice::WHISPER_LARGE_V3) - Image generation —
client.image_generation_model(...)(enable Rig’simagefeature) - Speech —
client.audio_generation_model(venice::TTS_KOKORO)(enable Rig’saudiofeature)
/augment/*, and crypto RPC have no Rig trait and are not wrapped. Call those Venice endpoints directly.
Privacy advantage
Rig is often used for agents that touch application data, user context, or internal tools. Pairing it with Venice keeps that workflow on private, uncensored inference:- Zero data retention on private models — prompts and tool payloads are not kept after the request
- Uncensored analysis when agents need blunt critique or red-teaming
- A first-party provider so you are not remapping OpenAI types onto Venice’s dialect
Troubleshooting
Model not found or unexpected endpoint errors
Model not found or unexpected endpoint errors
Use a current model ID from the models page or
GET /models. Crate constants such as venice::QWEN3_5_9B can lag the live catalog.Responses API failures
Responses API failures
Use
venice::Client, not openai::Client. The OpenAI client defaults to the Responses API, which is only alpha on Venice.Tools or structured output are ignored
Tools or structured output are ignored
Pick a model that supports function calling, describe when tools should run in the preamble, and keep tool descriptions precise — Rig builds JSON schemas from
#[rig_tool] signatures and docs.Rig Docs
Agents, tools, extractors, and providers
Venice Models
Browse models and supported capabilities