API Reference¶
Voidon provides a fully OpenAI-compatible API with powerful extensions. All endpoints follow REST conventions and return JSON responses.
Base URL¶
| Text Only | |
|---|---|
Authentication¶
All API requests require authentication using an API key in the Authorization header:
| HTTP | |
|---|---|
Chat Completions¶
POST /v1/chat/completions¶
Create a chat completion with automatic model selection, anonymization, and document processing.
Request Body¶
By default all of the parameters of the OpenAI endpoint /chat/completion are allowed, some of those are:
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model identifier. Use "auto" for intelligent selection |
messages | array | Yes | Array of message objects |
max_tokens | integer | No | Maximum tokens to generate (default: 1000) |
temperature | number | No | Sampling temperature (0-2, default: 1) |
stream | boolean | No | Enable streaming responses (default: false) |
extra_body (vodion extensions) | object | No | Voidon-specific features |
Voidon Extensions¶
| Parameter | Type | Description |
|---|---|---|
enable_anonymization | boolean | Enable automatic PII removal |
anonymization_types | list[int] | The numerical values for the types of entities to anonymize |
ignore_mismatched_parameters | boolean | Ignore specified parameters during the model selection phase, it can help if no model are found for that combination of parameters/providers |
Example Request¶
```java // Nota: la libreria standard com.theokanning.openai-service è fortemente // tipizzata e non supporta l'aggiunta di campi personalizzati come // "extra_body" al corpo della richiesta senza creare classi custom // o usare un client HTTP.
public class VoidonExample { public static void main(String[] args) { System.out.println("L'invio di estensioni personalizzate richiede un client HTTP o una customizzazione della libreria."); } } ```
```java // Nota: la libreria com.theokanning.openai-service non supporta // tipi di contenuto personalizzati come "file". L'approccio // corretto per questa libreria richiederebbe l'uso di un client HTTP // per costruire manualmente il body della richiesta JSON.
public class VoidonExample { public static void main(String[] args) { System.out.println("L'invio di tipi di contenuto personalizzati richiede un client HTTP."); } } ```
Response¶
Streaming Response¶
When stream: true, responses are sent as Server-Sent Events:
Model Selection¶
Automatic Model Selection¶
Use model: "auto" to let Voidon choose the optimal model based on:
- Cost efficiency: Balance quality vs. price
- Context length: Match your prompt length requirements
- Availability: Route around downtime
- Performance: Optimize for speed or quality
Specific Model Selection¶
You can also specify exact models using the format:
| Text Only | |
|---|---|
Examples: - openai/gpt-4o - anthropic/claude-3-5-sonnet - google/gemini-1.5-pro
Message Formats¶
Text Messages¶
Multi-Modal Messages¶
| JSON | |
|---|---|
Document Messages¶
| JSON | |
|---|---|
To see a supported file formats list please visit the Document page
Best Practices¶
Optimize Costs
Use model: "auto" to automatically choose cost-effective models.
Handle Rate Limits
Implement exponential backoff for 429 responses.
Stream Long Responses
Use stream: true for better user experience with long responses.
Secure PII
Enable anonymization when processing user-generated content.
Monitor Usage
Check the dashboard regularly to track usage and costs.
OpenAPI Schema Reference¶
Voidon provides a complete OpenAPI 3.1.0 specification. The full schema is available at:
| Text Only | |
|---|---|
Request Schema¶
The /v1/chat/completions endpoint accepts the following request structure:
| Field | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | Model identifier (e.g., "auto", "openai/gpt-4o") |
messages | array | ❌ | Array of message objects (default: []) |
functions | array | null | ❌ | Legacy function calling support |
function_call | string | null | ❌ | Legacy function call control |
timeout | number | integer | null | ❌ | Request timeout in seconds |
temperature | number | null | ❌ | Sampling temperature (0-2) |
top_p | number | null | ❌ | Nucleus sampling parameter |
n | integer | null | ❌ | Number of completions to generate |
stream | boolean | null | ❌ | Enable streaming responses |
stream_options | object | null | ❌ | Streaming configuration options |
stop | string | array | null | ❌ | Stop sequences |
max_tokens | integer | null | ❌ | Maximum tokens in completion |
max_completion_tokens | integer | null | ❌ | Alternative max tokens parameter |
modalities | array[enum] | null | ❌ | Response modalities: ["text", "audio"] |
prediction | ChatCompletionPredictionContentParam | null | ❌ | Predictive completion hints |
audio | ChatCompletionAudioParam | null | ❌ | Audio output configuration |
presence_penalty | number | null | ❌ | Presence penalty (-2.0 to 2.0) |
frequency_penalty | number | null | ❌ | Frequency penalty (-2.0 to 2.0) |
logit_bias | object | null | ❌ | Token bias adjustments |
user | string | null | ❌ | End-user identifier |
response_format | object | null | ❌ | Response format specification (e.g., JSON mode) |
seed | integer | null | ❌ | Deterministic sampling seed |
tools | array | null | ❌ | Available tools for function calling |
tool_choice | string | object | null | ❌ | Tool selection strategy |
parallel_tool_calls | boolean | null | ❌ | Enable parallel tool execution |
logprobs | boolean | null | ❌ | Return log probabilities |
top_logprobs | integer | null | ❌ | Number of top logprobs to return |
deployment_id | string | null | ❌ | Azure deployment identifier |
reasoning_effort | enum | null | ❌ | Reasoning effort: minimal, low, medium, high |
base_url | string | null | ❌ | Custom base URL override |
api_version | string | null | ❌ | API version override |
api_key | string | null | ❌ | API key override |
model_list | array | null | ❌ | Custom model list |
extra_headers | object | null | ❌ | Additional HTTP headers |
thinking | AnthropicThinkingParam | null | ❌ | Anthropic extended thinking mode |
web_search_options | OpenAIWebSearchOptions | null | ❌ | Web search configuration |
enable_anonymization | boolean | ❌ | Voidon Extension: Enable PII anonymization (default: account setting) |
enable_anonymization | boolean | ❌ | Voidon Extension: Enable automatic PII removal |
anonymization_types | list[int] | ❌ | Voidon Extension: The numerical values for the types of entities to anonymize |
ignore_mismatched_parameters | boolean | ❌ | Voidon Extension: Ignore specified parameters during the model selection phase, it can help if no model are found for that combination of parameters/providers |
Supporting Schemas¶
Prediction Schema¶
ChatCompletionPredictionContentParam
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | Must be "content" |
content | string | array[ChatCompletionContentPartTextParam] | ✅ | Predicted content |
Audio Schema¶
ChatCompletionAudioParam
| Field | Type | Required | Description |
|---|---|---|---|
format | enum | ✅ | Audio format: wav, aac, mp3, flac, opus, pcm16 |
voice | string | enum | ✅ | Voice ID or preset: alloy, ash, ballad, coral, echo, sage, shimmer, verse |
Thinking Schema¶
AnthropicThinkingParam
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | Must be "enabled" |
budget_tokens | integer | ✅ | Token budget for thinking |
Web Search Schema¶
OpenAIWebSearchOptions
| Field | Type | Required | Description |
|---|---|---|---|
search_context_size | enum | null | ❌ | Context size: low, medium, high |
user_location | OpenAIWebSearchUserLocation | null | ❌ | User location for localized results |
User Location¶
OpenAIWebSearchUserLocation
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | Must be "approximate" |
approximate | object | ✅ | Approximate location |
approximate.city | string | ✅ | City name |
approximate.country | string | ✅ | Country code |
approximate.region | string | ✅ | Region/state name |
approximate.timezone | string | ✅ | IANA timezone |
Text Content¶
ChatCompletionContentPartTextParam
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | Must be "text" |
text | string | ✅ | Text content |
Response Schema¶
The endpoint returns a ModelResponse object:
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | Unique completion identifier |
created | integer | ✅ | Unix timestamp of creation |
object | string | ✅ | Object type: "chat.completion" or "chat.completion.chunk" |
model | string | null | ❌ | Model that generated the response |
system_fingerprint | string | null | ❌ | System configuration fingerprint |
choices | array[Choices | StreamingChoices] | ✅ | Array of completion choices |
Supporting Response Schemas¶
Choices Schema¶
Choices
| Field | Type | Required | Description |
|---|---|---|---|
finish_reason | string | ✅ | Reason for completion: stop, length, function_call, tool_calls, content_filter |
index | integer | ✅ | Choice index in array |
message | Message | ✅ | Generated message |
logprobs | ChoiceLogprobs | null | ❌ | Log probabilities (if requested) |
provider_specific_fields | object | null | ❌ | Provider-specific metadata |
Message Schema¶
Message
| Field | Type | Required | Description |
|---|---|---|---|
role | enum | ✅ | Message role: assistant, user, system, tool, function |
content | string | null | ✅ | Message text content |
tool_calls | array[ChatCompletionMessageToolCall] | null | ✅ | Tool/function calls made |
function_call | FunctionCall | null | ✅ | Legacy function call (deprecated) |
audio | ChatCompletionAudioResponse | null | ❌ | Audio response (if modality enabled) |
reasoning_content | string | null | ❌ | Reasoning trace (o1 models) |
thinking_blocks | array[ThinkingBlock] | null | ❌ | Extended thinking blocks (Anthropic) |
annotations | array[ChatCompletionAnnotation] | null | ❌ | Content annotations (citations, etc.) |
Tool Call¶
ChatCompletionMessageToolCall
Dynamic object containing tool call information. Structure depends on the tool.
Function Call¶
FunctionCall (deprecated, use tool_calls instead)
| Field | Type | Required | Description |
|---|---|---|---|
arguments | string | ✅ | JSON string of function arguments |
name | string | null | ❌ | Function name |
Audio Response¶
ChatCompletionAudioResponse
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✅ | Audio data identifier |
data | string | ✅ | Base64-encoded audio data |
expires_at | integer | ✅ | Unix timestamp of expiration |
transcript | string | ✅ | Text transcript of audio |
Thinking Block¶
ChatCompletionThinkingBlock or ChatCompletionRedactedThinkingBlock
Thinking block (full):
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | Must be "thinking" |
thinking | string | ✅ | Thinking content |
signature | string | ✅ | Signature/hash of thinking |
cache_control | object | null | ❌ | Caching metadata |
Redacted thinking block:
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | Must be "redacted_thinking" |
data | string | ❌ | Redacted placeholder |
cache_control | object | null | ❌ | Caching metadata |
Annotation¶
ChatCompletionAnnotation
| Field | Type | Required | Description |
|---|---|---|---|
type | string | ✅ | Must be "url_citation" |
url_citation | object | ✅ | Citation metadata |
url_citation.start_index | integer | ✅ | Start position in content |
url_citation.end_index | integer | ✅ | End position in content |
url_citation.url | string | ✅ | Citation URL |
url_citation.title | string | ✅ | Citation title |
Logprobs Schema¶
ChoiceLogprobs
| Field | Type | Required | Description |
|---|---|---|---|
content | array[ChatCompletionTokenLogprob] | null | ❌ | Token-level log probabilities |
Token Logprob¶
ChatCompletionTokenLogprob
| Field | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Token string |
bytes | array[integer] | null | ❌ | UTF-8 byte representation |
logprob | number | ✅ | Log probability of token |
top_logprobs | array[TopLogprob] | ✅ | Alternative tokens with probabilities |
Top Logprob¶
TopLogprob
| Field | Type | Required | Description |
|---|---|---|---|
token | string | ✅ | Alternative token |
bytes | array[integer] | null | ❌ | UTF-8 byte representation |
logprob | number | ✅ | Log probability |
Streaming Choices¶
StreamingChoices
Dynamic object for streaming responses. Contains partial delta updates instead of complete messages.
Example Request/Response¶
Error Responses¶
When validation fails, the API returns a 422 Validation Error:
| JSON | |
|---|---|
HTTPValidationError
| Field | Type | Description |
|---|---|---|
detail | array[ValidationError] | Array of validation errors |
Validation Error¶
| Field | Type | Description |
|---|---|---|
loc | array[string | integer] | Error location path |
msg | string | Human-readable error message |
type | string | Error type identifier |