deepinfra

package module
v0.0.0-...-d2615e4 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: AGPL-3.0 Imports: 5 Imported by: 4

README

deepinfra

Lightweight OpenAI/OLLaMA/GenAI compatible caller, originally designed for DeepInfra.

Quick Start

package main

import (
	"fmt"

	"github.com/fumiama/deepinfra"
	"github.com/fumiama/deepinfra/model"
)

func main() {
	api := deepinfra.NewAPI(deepinfra.OpenAIDeepInfra, "PUT YOUR API KEY HERE")
	txt, err := api.Request(model.NewOpenAI(model.ModelDeepDeek, model.SeparatorThink, 0.7, 0.9, 1024).
		System("Be a good assistant.").User(model.NewContentText("Hello")),
	)
	if err != nil {
		panic(err)
	}
	fmt.Println(txt)
	// Hello! How can I assist you today?
}

Documentation

Index

Constants

View Source
const (
	OpenAIDeepInfra = "https://api.deepinfra.com/v1/openai/chat/completions"
	GenAIGoogle     = "https://generativelanguage.googleapis.com/v1beta"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(api, key string) API

func (*API) Request

func (api *API) Request(model Model) (string, error)

func (*API) SetHTTPClient

func (api *API) SetHTTPClient(c *http.Client)

type Model

type Model interface {
	model.Inputer
	model.Outputer
	model.Requester
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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