Expand description
Inference Gateway SDK for Rust
This crate provides a Rust client for the Inference Gateway API, allowing interaction with various LLM providers through a unified interface.
Data types in [crate::generated::schemas] are generated from the upstream
openapi.yaml and re-exported at the crate root. Run task generate-types
to regenerate them after a spec bump.
Modules§
Structs§
- Chat
Completion Choice ChatCompletionChoice- Chat
Completion Choice Logprobs - Log probability information for the choice.
- Chat
Completion Message Tool Call ChatCompletionMessageToolCall- Chat
Completion Message Tool Call Chunk ChatCompletionMessageToolCallChunk- Chat
Completion Message Tool Call Function - The function that the model called.
- Chat
Completion Stream Choice ChatCompletionStreamChoice- Chat
Completion Stream Choice Logprobs - Log probability information for the choice.
- Chat
Completion Stream Options - Options for streaming response. Only set this when you set
stream: true. - Chat
Completion Stream Response Delta - A chat completion delta generated by streamed model responses.
- Chat
Completion Token Logprob ChatCompletionTokenLogprob- Chat
Completion Token Logprob TopLogprobs Item ChatCompletionTokenLogprobTopLogprobsItem- Chat
Completion Tool ChatCompletionTool- Completion
Usage - Usage statistics for the completion request.
- Config
Config- Create
Chat Completion Request CreateChatCompletionRequest- Create
Chat Completion Response - Represents a chat completion response returned by model, based on the provided input.
- Create
Chat Completion Stream Response - Represents a streamed chunk of a chat completion response returned by the model, based on the provided input.
- Endpoints
Endpoints- Error
Error- Function
Object FunctionObject- Function
Parameters - The parameters the functions accepts, described as a JSON Schema object. See the guide for examples, and the JSON Schema reference for documentation about the format.
Omitting
parametersdefines a function with an empty parameter list. - Image
Content Part - Image content part
- Image
Url - Image URL configuration
- Inference
Gateway Client - Client for interacting with the Inference Gateway API
- List
Models Response - Response structure for listing models
- List
Tools Response - Response structure for listing MCP tools
- McpTool
- An MCP tool definition
- Message
- Message structure for provider requests
- Model
- Common model information
- Provider
Specific Response - Provider-specific response format. Examples:
- SSEvents
- Stream of Server-Sent Events (SSE) yielded by
InferenceGatewayAPI::generate_content_stream. - SsEvent
SsEvent- Text
Content Part - Text content part
- Tool
Call Extra Content - Provider-specific opaque data attached to a tool call. The contents are
not interpreted by the gateway, but must be echoed back verbatim on the
next request that references this tool call. Currently used by Google
Gemini extended-thinking models to carry the per-call
thought_signature. Other providers may ignore the field. - Tool
Call Extra Content Google - Google Gemini-specific extra content.
Enums§
- Chat
Completion Tool Type - The type of the tool. Currently, only
functionis supported. - Content
Part - A content part within a multimodal message
- Finish
Reason - The reason the model stopped generating tokens. This will be
stopif the model hit a natural stop point or a provided stop sequence,lengthif the maximum number of tokens specified in the request was reached,content_filterif content was omitted due to a flag from our content filters,tool_callsif the model called a tool. - Gateway
Error - Custom error types for the Inference Gateway SDK
- Image
Content Part Type - Content type identifier
- Image
UrlDetail - Image detail level for vision processing
- Message
Content - Message content - either text or multimodal content parts
- Message
Role - Role of the message sender
- Provider
Provider- Provider
Auth Type - Authentication type for providers
- SsEvent
Event SsEventEvent- Text
Content Part Type - Content type identifier
Traits§
- Inference
GatewayAPI - Core API interface for the Inference Gateway