Expand description
OpenAI API compatibility types
This module defines types that match the OpenAI API specification for chat completions, completions, and model management.
Structs§
- Chat
Choice - Chat choice
- Chat
Completions Request - Chat completions request (OpenAI compatible)
- Chat
Completions Response - Chat completions response
- Chat
Function - Function schema for
tools[].functionand legacyfunctions[]. - Chat
Function Call - Function call payload. OpenAI serializes arguments as a JSON string.
- Chat
Message - Chat message
- Chat
Tool - Tool definition in OpenAI chat-completion requests.
- Chat
Tool Call - Assistant tool call in OpenAI responses and historical conversation input.
- Completion
Choice - Completion choice
- Completions
Request - Legacy completions request
- Completions
Response - Completions response
- Embedding
Data - Single embedding result
- Embedding
Item - A single embedding input item — text or image.
- Embedding
Usage - Token usage for embeddings
- Embeddings
Request - Embeddings request (OpenAI-compatible, extended for images)
- Embeddings
Response - Embeddings response (OpenAI-compatible)
- Model
Info - Model information
- Model
List Response - Model list response
- Model
Permission - Model permission
- Open
AiError - OpenAI API error
- Open
AiError Detail - OpenAI error detail
- Open
AiJson Schema - Open
AiResponse Format - OpenAI-compatible response format specifier.
- Speech
Request - TTS speech request (OpenAI compatible /v1/audio/speech)
- SseEvent
- Server-sent event for streaming
- Stream
Options - OpenAI streaming options.
- Tool
Choice Function - Transcription
Response - Transcription response (OpenAI-compatible)
- Usage
- Token usage information
Enums§
- Completion
Prompt - Legacy completions prompt. Kept as a parsed enum so the HTTP layer can return an OpenAI-shaped field error instead of a generic JSON rejection.
- Embedding
Input - Polymorphic embedding input. Supports: single string, array of strings, single object, array of objects.
- Function
Call Choice - Legacy
function_callaccepts a simple mode string or a named function. - Message
Role - Message roles
- Open
AiError Type - OpenAI error types
- Tool
Choice - OpenAI
tool_choiceaccepts either a simple mode string or a specific function-tool selector object.