feat: Add Venice AI provider integration - #3079
Open
actuallyrizzn wants to merge 5 commits into
Open
Conversation
- Introduced Venice API key in ModelSettings. - Updated LLMClient to handle Venice as a provider. - Added Venice to ProviderType enum. - Registered VeniceProvider in the providers module. - Integrated VeniceProvider into the SyncServer for API key management.
- Added support for the Venice endpoint in embedding and LLM configurations. - Updated VeniceClient to include a default context window for embeddings. - Improved test coverage for VeniceClient, including error handling and API interactions. - Refactored mock responses in tests for better clarity and reliability.
- Add comprehensive docstrings to all methods matching Letta codebase style - Add inline comments for complex logic (SSE parsing, error mapping, retry) - Document Venice-specific parameters and error handling approach - Clean up unused imports (ErrorCode, Dict, Tuple) - Improve error message clarity and consistency
- Updated is_reasoning_model() to query Venice API and check model_spec.traits - Models with reasoning traits (reasoning, reasoner, thinking, o1, o3, o4) are correctly identified - Added comprehensive tests for reasoning model detection (5 new tests) - Updated PR description to reflect correct behavior
… doesn't list them - Venice API /models endpoint only returns text models, not embedding models - Embeddings work via /embeddings endpoint but models aren't discoverable - Hardcode common embedding models (ada-002, embedding-3-small/large, bge-m3) - All return 1024 dimensions (verified with live API) - Updated test to match new hardcoded implementation
huangyingting
pushed a commit
to repomesh/letta
that referenced
this pull request
May 17, 2026
Co-authored-by: Jin Peng <jinjpeng@Jins-MacBook-Pro.local>
huangyingting
pushed a commit
to repomesh/letta
that referenced
this pull request
May 17, 2026
Co-authored-by: Jin Peng <jinjpeng@Jins-MacBook-Pro.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Venice AI Integration
Overview
This PR adds Venice AI as a new LLM provider to Letta, enabling users to use Venice AI models for chat completions, streaming, tool calling, and embeddings generation.
Changes
Core Implementation
letta/llm_api/venice_client.py(NEW): Venice AI LLM client implementationLLMClientBasewith all required abstract methodsletta/llm_api/venice.py(NEW): Helper function for Venice API model listingvenice_get_model_list_async(): Queries Venice API for available modelsletta/schemas/providers/venice.py(NEW): Venice provider implementationVeniceProvider: Dynamically lists models from Venice APIvenice_api_keyis configuredConfiguration
letta/schemas/enums.py: AddedvenicetoProviderTypeenumletta/llm_api/llm_client.py: Registered Venice in LLM client factoryletta/settings.py: Addedvenice_api_keytoModelSettingsletta/server/server.py: Auto-registers VeniceProvider when API key is setletta/schemas/providers/__init__.py: Exports VeniceProviderletta/schemas/llm_config.py: Added"venice"tomodel_endpoint_typeLiteralletta/schemas/model.py: Added"venice"tomodel_endpoint_typeLiteral (deprecated schema)letta/schemas/embedding_config.py: Added"venice"toembedding_endpoint_typeLiteralTesting
tests/test_venice_client.py: Comprehensive unit tests for VeniceClient (100% coverage)tests/test_venice_provider.py: Unit tests for VeniceProvider (100% coverage)tests/test_venice_helper.py: Unit tests for helper functions (100% coverage)tests/test_venice_coverage_comprehensive.py: Additional coverage tests for edge casestests/test_venice_live_api.py: Live API integration tests (6/6 passing with real API key)tests/integration_test_venice.py: E2E tests (requires database setup)Features
✅ Chat Completions: Synchronous and asynchronous requests
✅ Streaming: Server-Sent Events (SSE) streaming support
✅ Tool Calling: OpenAI-compatible function/tool calling
✅ Embeddings: Batch embeddings generation
✅ Error Handling: Comprehensive error mapping with retry logic
✅ Dynamic Model Listing: Models discovered from Venice API
✅ BYOK Support: Bring Your Own Key provider support
✅ 100% Test Coverage: Unit, integration, and E2E tests
API Compatibility
Venice AI uses OpenAI-compatible API format, so integration is seamless:
Configuration
Users can configure Venice AI by setting:
Or in settings:
Models are automatically discovered and available as
venice/{model_id}.Testing
Documentation
User documentation has been prepared (see
VENICE_USER_DOCS.mdandVENICE_SETUP_GUIDE.mdin workspace root - not committed to repo).Breaking Changes
None. This is a purely additive change.
Checklist
Related Issues
Notes
is_reasoning_model()queries the Venice API to check model traits. Models with reasoning capabilities (indicated by traits like "reasoning", "reasoner", "thinking", "o1", "o3", "o4") are correctly identified as reasoning models./modelsendpoint doesn't return embedding models, but embeddings work via the/embeddingsendpoint. We hardcode common embedding models (text-embedding-ada-002, text-embedding-3-small, text-embedding-3-large, text-embedding-bge-m3) similar to OpenAI's approach.