deepinfra

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package deepinfra provides DeepInfra integration for the LLM gateway.

Index

Constants

This section is empty.

Variables

View Source
var Registration = providers.Registration{
	Type: "deepinfra",
	New:  New,
	Discovery: providers.DiscoveryConfig{
		DefaultBaseURL: defaultBaseURL,
	},
}

Registration provides factory registration for the DeepInfra provider.

Functions

func New

New creates a new DeepInfra provider.

Types

type Provider

Provider implements DeepInfra's OpenAI-compatible API. Chat completions, embeddings, and passthrough go through the shared chat-centric adapter; Responses is forwarded to DeepInfra's native /responses endpoint, except requests setting "text", which are translated through chat completions; image generation and edits, speech, transcription, translation, files, and batches use the matching OpenAI routes. DeepInfra's Responses endpoint is stateless, so no response lifecycle (retrieve, cancel, delete) is exposed: the gateway replays previous_response_id history itself when it has a response store.

func (*Provider) CreateImage

CreateImage generates images through DeepInfra's /images/generations endpoint.

func (*Provider) CreateImageEdit

func (p *Provider) CreateImageEdit(ctx context.Context, req *core.ImageEditRequest) (*core.ImageGenerationResponse, error)

CreateImageEdit edits images through DeepInfra's /images/edits endpoint.

func (*Provider) CreateSpeech

func (p *Provider) CreateSpeech(ctx context.Context, req *core.AudioSpeechRequest) (*core.AudioResponse, error)

CreateSpeech synthesizes speech through DeepInfra's /audio/speech endpoint. DeepInfra answers WAV when response_format is omitted, so the OpenAI default ("mp3") is sent explicitly.

func (*Provider) CreateTranscription

func (p *Provider) CreateTranscription(ctx context.Context, req *core.AudioTranscriptionRequest) (*core.AudioResponse, error)

CreateTranscription transcribes audio through DeepInfra's /audio/transcriptions endpoint.

func (*Provider) CreateTranslation

func (p *Provider) CreateTranslation(ctx context.Context, req *core.AudioTranscriptionRequest) (*core.AudioResponse, error)

CreateTranslation translates audio into English through DeepInfra's /audio/translations endpoint.

func (*Provider) ListModels

func (p *Provider) ListModels(ctx context.Context) (*core.ModelsResponse, error)

ListModels returns DeepInfra's model catalog with the context, pricing, and kind tags its OpenAI-compatible listing carries. Models whose tags name only kinds the gateway cannot serve (video generation) are skipped so the catalog never advertises a model that can only fail.

func (*Provider) Responses

Responses forwards a Responses API request to DeepInfra's native endpoint, or through chat completions when the native endpoint cannot serve it (see needsChatTranslation).

func (*Provider) StreamResponses

func (p *Provider) StreamResponses(ctx context.Context, req *core.ResponsesRequest) (io.ReadCloser, error)

StreamResponses streams a Responses API request the same way Responses routes it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL