Production-ready OpenAPI definition for the Venice.ai API. This repository hosts the canonical spec used to generate SDKs, publish reference docs, and validate compatibility.
- TL;DR
- What is This?
- Contents
- Quick Start
- For Developers
- Generate SDKs
- Mock Server
- Differences from OpenAI's API
- Technical Specifications
- Usage Instructions
- Quality Metrics
- Additional Resources
- Spec lives in:
venice.openapi.v3.yaml - Lint and preview locally using the provided
lint.shscript. - Generate SDKs via
openapi-generator - Publish docs with your preferred pipeline (Swagger UI / Redoc)
This repository contains the official OpenAPI 3.0.0 specification for the Venice.ai API. The specification serves as:
- π Single Source of Truth: Canonical documentation for all API endpoints, parameters, and responses
- π§ SDK Generation: Input for generating client libraries in multiple programming languages
- π Interactive Documentation: Source for Swagger UI, Redoc, and other API documentation tools
- β Validation: Reference for validating API requests and responses
- π€ Integration Guide: Complete reference for developers integrating with Venice.ai
- OpenAI Compatible: Drop-in replacement for OpenAI API clients
- Privacy Focused: Zero data retention - your data is never stored
- Comprehensive: Covers all Venice.ai API features including chat, images, audio, embeddings, and more
- Production Ready: Fully validated and tested specification
- Well Documented: Extensive examples, descriptions, and code samples
.
ββ venice.openapi.v3.yaml # The complete OpenAPI specification
ββ .spectral.yaml # Configuration for the Spectral linter
ββ lint.sh # Script to run local validation
ββ package.json # Node.js dependencies for linting
ββ README.md # This file
- Open editor.swagger.io
- Import
venice.openapi.v3.yaml - Confirm no errors; warnings are documented in comments where applicable.
A lint.sh script is provided to simplify local validation. It runs both Spectral and Redocly linters to ensure the OpenAPI specification is valid and adheres to style guidelines.
Prerequisites:
- Make sure
npmis installed. - Install the required Node.js dependencies:
npm install
Usage: To run the linters, execute the script from the root of the repository:
./lint.shThis will validate the venice.openapi.v3.yaml file and report any errors or warnings.
# Option A: Serve with Docker (swaggerapi/swagger-ui)
docker run -p 8080:8080 -e SWAGGER_JSON=/tmp/spec.yaml -v "$PWD/venice.openapi.v3.yaml":/tmp/spec.yaml swaggerapi/swagger-ui
# Option B: Redoc (static)
npx @redocly/cli build-docs venice.openapi.v3.yaml -o docs/index.htmlThe repository includes automated tests to validate the OpenAPI specification and code generation:
# Run comprehensive OpenAPI spec validation
python3 test_openapi_spec.py
# Run specific bug fix test (Preview tag)
python3 test_preview_tag_bug.py
# Run code sample generation tests
python3 test_add_code_samples.py
# Run code sample syntax validation tests
python3 test_code_sample_syntax.py
# Run edge case tests
python3 test_add_code_samples_edge_cases.py
# Run all tests
for test in test_*.py; do python3 "$test"; doneTest Coverage:
- β File existence and YAML validity - Validates spec file structure
- β OpenAPI version compliance - Ensures 3.0.0 compatibility
- β Required sections - Validates info, servers, paths sections
- β Security scheme definitions - Checks authentication setup
- β Tag definitions and consistency - Ensures all tags are defined
- β Component schema validation - Validates reusable schemas
- β Code sample syntax - Verifies generated samples are valid
- β Edge case handling - Tests error conditions and boundary cases
- β Bug fixes - Regression tests for identified bugs
Test Statistics:
- Total Test Suites: 5
- Total Test Cases: 33
- Code Coverage: Comprehensive (all major functions tested)
- All Tests Passing: β 100%
This repository follows best practices for code quality and maintainability:
Documentation:
- β All public functions have comprehensive Google-style docstrings
- β Clear descriptions of parameters, return values, and side effects
- β Usage examples included in docstrings
- β Module-level documentation for each file
Testing:
- β 33 comprehensive test cases covering all functionality
- β Edge case and boundary condition testing
- β Syntax validation for generated code samples
- β Regression tests for identified bugs
- β 100% test pass rate
Error Handling:
- β Graceful handling of missing files and invalid YAML
- β Proper encoding support (UTF-8)
- β Validation of HTTP methods and path structures
- β Informative error messages
The OpenAPI specification is organized into several key sections:
Contains metadata about the API including title, version, description, and contact information.
Defines authentication methods. Venice.ai uses Bearer token authentication with JWT format.
# In your requests:
Authorization: Bearer YOUR_API_KEYOrganizes endpoints into logical groups:
- Chat: Conversational AI endpoints
- Models: Model listing and information
- Image: Image generation and manipulation
- Characters: Custom AI personas
- API Keys: Key management
- Embeddings: Text embeddings
- Audio/Speech: Text-to-speech
- Billing: Usage tracking
Reusable schema definitions for requests and responses. These are referenced throughout the spec using $ref.
The actual API endpoints with their:
- Operations: GET, POST, DELETE, etc.
- Parameters: Query, path, and header parameters
- Request Bodies: Expected input schemas
- Responses: Possible response codes and schemas
- Examples: Request and response examples
- Code Samples: Usage examples in multiple languages
When modifying the specification:
- Edit
venice.openapi.v3.yamldirectly - Follow OpenAPI 3.0.0 standards - refer to OpenAPI Specification
- Validate frequently - run
./lint.shafter each change - Test your changes - preview in Swagger UI or Redoc
- Check examples - ensure all examples are valid and realistic
Adding a new endpoint:
paths:
/your/new/endpoint:
post:
summary: Brief description
description: Detailed explanation
tags:
- YourTag
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/YourSchema'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/YourResponseSchema'Adding a new schema:
components:
schemas:
YourSchema:
type: object
properties:
field_name:
type: string
description: What this field represents
example: "example value"
required:
- field_nameAdding code samples:
x-codeSamples:
- lang: 'Python'
label: 'Basic Example'
source: |
import requests
response = requests.post(
'https://api.venice.ai/api/v1/your/endpoint',
headers={'Authorization': 'Bearer {VENICE_API_KEY}'},
json={'field': 'value'}
)We welcome contributions! Please see CONTRIBUTING.md for detailed guidelines on:
- Setting up your development environment
- Testing changes
- Submitting pull requests
- Code style and documentation standards
Quick contribution checklist:
- Fork the repository
- Create a feature branch
- Make your changes
- Run
./lint.shto validate - Test in Swagger UI or Redoc
- Submit a pull request with clear description
Using openapi-generator (Java-based tool):
# Install (one-time)
brew install openapi-generator # macOS
# or: docker pull openapitools/openapi-generator-cli
# Typescript (fetch)
openapi-generator generate -i venice.openapi.v3.yaml -g typescript-fetch -o sdk/typescript
# Python
openapi-generator generate -i venice.openapi.v3.yaml -g python -o sdk/pythonNotes:
- File upload endpoints are modeled with
oneOffor binary (multipart), byte (base64 in JSON), and uri. Your generator should map these appropriately. - Chat completion response
roleis restricted toassistantfor OpenAI compatibility.
docker run -p 4010:4010 -v "$PWD/venice.openapi.v3.yaml:/tmp/spec.yaml" stoplight/prism:4 mock -h 0.0.0.0 /tmp/spec.yamlWhile Venice maintains high compatibility with the OpenAI API specification, there are some Venice-specific features and parameters:
venice_parameters: Venice offers additional configurations not available via OpenAI.- System Prompts: Different default behavior for system prompt handling.
- Model Names: Venice provides transformation for some common OpenAI model selections to comparable Venice support models, although it is recommended to review the models available on Venice directly.
- Web Search Integration: Built-in web search with citations.
- Character Interactions: AI personalities and conversation styles.
- Reasoning Models: Advanced thinking and reasoning capabilities.
- Uncensored Responses: Default prompts designed for natural responses.
- OpenAPI 3.0.0 Compliant
- 0 Critical Errors
- 0 Warnings
- Ready for Production Use
- Fixed nullable field handling across all schemas
- Improved type definitions with proper constraints
- Enhanced validation rules for request/response models
- Consistent schema structure throughout
- Summary & Description: Clear, feature-rich descriptions
- Parameters: Fully documented with examples and constraints
- Request Body: Comprehensive examples covering all major endpoints.
- Responses: Detailed success/error responses with headers
- Headers: Rate limiting, compression, request IDs
Comprehensive x-codeSamples covering:
cURL Examples:
curl -X POST "https://api.venice.ai/v1/chat/completions" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{
"model": "venice-pro",
"messages": [{"role": "user", "content": "Hello Venice"}]
}'JavaScript Examples:
const response = await fetch("https://api.venice.ai/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "venice-pro",
messages: [{ role: "user", content: "Hello Venice" }]
})
});
const data = await response.json();
console.log(data);Python Examples:
import requests
url = "https://api.venice.ai/v1/chat/completions"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
data = {
"model": "venice-pro",
"messages": [{"role": "user", "content": "Hello Venice"}]
}
response = requests.post(url, json=data, headers=headers)
print(response.json())Tag Organization:
x-tagGroups:
- name: Core AI Services
tags: [Chat, Image, Audio, Speech, Embeddings]
- name: Platform
tags: [Models, Characters, Billing, API Keys]
- name: Experimental
tags: [Preview]Enhanced Documentation:
- Private AI guarantee prominently featured
- Zero-retention policy clearly explained
- Feature capabilities well documented
- Rate limiting and authentication details
- Comprehensive error handling guidance
- Use
venice.openapi.v3.yamlwith Redoc, Swagger UI, or similar tools - The specification includes
x-logoand styling information - Tag groups provide logical navigation structure
- All schemas are properly defined for client generation
- Examples provide realistic integration patterns
- Error handling is comprehensively documented
- Copy code samples and replace
{VENICE_API_KEY}with actual API key - Examples demonstrate all major Venice features
- Authentication and error handling patterns included
| Metric | Status | Details |
|---|---|---|
| Validation | β | 0 errors, 0 minor warnings |
| Coverage | β | Complete /chat/completions documentation |
| Examples | β | All endpoints have code samples |
| Error Handling | β | All HTTP status codes documented |
| Authentication | β | Bearer token with examples |
| Features | β | Streaming, vision, tools, web search |
- API Key Placeholder: All code samples use
YOUR_API_KEYas a placeholder. - Production Ready: Specification validates without errors
- Comprehensive Coverage: All major Venice features documented
- Best Practices: Follows OpenAPI 3.0.0 standards and conventions
Issue: Generated code samples for POST/PUT/PATCH operations contained syntax errors:
- cURL samples missing line continuation backslash after Authorization header
- JavaScript samples missing comma after Authorization header in object literals
Impact: Users copying examples would encounter syntax errors when executing the code.
Fix: Updated add_code_samples.py to generate syntactically correct samples:
- β cURL: Proper line continuation with backslashes
- β JavaScript: Valid object literal syntax with commas
- β Verified with comprehensive test suite (10 tests)
Test: Run python3 test_code_sample_syntax.py to verify the fix.
Details: See BUG_REPORT_CODE_SAMPLES.md for complete analysis.
Issue: The "Preview" tag was used in operation definitions but not defined in the global tags section.
Fix: Added Preview tag definition with appropriate description for beta/experimental endpoints.
Test: Run python3 test_preview_tag_bug.py to verify the fix.
Details: See BUG_REPORT_PREVIEW_TAG.md for complete analysis.
- Official API Docs: https://docs.venice.ai
- Venice.ai Platform: https://venice.ai
- OpenAPI Specification: https://spec.openapis.org/oas/v3.0.0
- Swagger Editor: https://editor.swagger.io - Online editor and validator
- Redocly CLI: https://redocly.com/docs/cli - Advanced linting and documentation
- Spectral: https://stoplight.io/open-source/spectral - OpenAPI linter
- OpenAPI Generator: https://openapi-generator.tech - SDK generation tool
- Discord Community: Join for support and updates
- GitHub Issues: Report bugs or request features
- Support Email: [email protected]
- CONTRIBUTING.md - Contribution guidelines
- Venice.ai API reference KNOWLEDGE BASE.md - Comprehensive API knowledge base
- Current OpenAPI Version: 3.0.0
- API Version: 20250929.201934
- Last Updated: 2025-10-03
Maintained by: Fayeblade1488
License: MIT
Repository: venice-API-reference