baiduv2

package
v0.0.0-...-4a3b078 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModelList = []*model.ModelConfig{
	{
		Model:       "ERNIE-4.0-8K-Latest",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.03,
		OutputPrice: 0.09,
		RPM:         120,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(5120),
			model.WithModelConfigMaxInputTokens(5120),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-4.0-8K-Preview",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.03,
		OutputPrice: 0.09,
		RPM:         300,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(5120),
			model.WithModelConfigMaxInputTokens(5120),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-4.0-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.03,
		OutputPrice: 0.09,
		RPM:         10000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(5120),
			model.WithModelConfigMaxInputTokens(5120),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-4.0-Turbo-8K-Latest",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.02,
		OutputPrice: 0.06,
		RPM:         60,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(6144),
			model.WithModelConfigMaxInputTokens(6144),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-4.0-Turbo-8K-Preview",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.02,
		OutputPrice: 0.06,
		RPM:         60,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(6144),
			model.WithModelConfigMaxInputTokens(6144),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-4.0-Turbo-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.02,
		OutputPrice: 0.06,
		RPM:         10000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(6144),
			model.WithModelConfigMaxInputTokens(6144),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-4.0-Turbo-128K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.02,
		OutputPrice: 0.06,
		RPM:         60,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(126976),
			model.WithModelConfigMaxInputTokens(126976),
			model.WithModelConfigMaxOutputTokens(4096),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-3.5-8K-Preview",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0008,
		OutputPrice: 0.002,
		RPM:         300,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(5120),
			model.WithModelConfigMaxInputTokens(5120),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-3.5-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0008,
		OutputPrice: 0.002,
		RPM:         10000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(5120),
			model.WithModelConfigMaxInputTokens(5120),
			model.WithModelConfigMaxOutputTokens(2048),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-3.5-128K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0008,
		OutputPrice: 0.002,
		RPM:         5000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(126976),
			model.WithModelConfigMaxInputTokens(126976),
			model.WithModelConfigMaxOutputTokens(4096),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-Speed-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0001,
		OutputPrice: 0.0001,
		RPM:         500,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(7168),
			model.WithModelConfigMaxInputTokens(7168),
			model.WithModelConfigMaxOutputTokens(2048),
		),
	},
	{
		Model:       "ERNIE-Speed-128K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0001,
		OutputPrice: 0.0001,
		RPM:         500,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(126976),
			model.WithModelConfigMaxInputTokens(126976),
			model.WithModelConfigMaxOutputTokens(4096),
		),
	},
	{
		Model:       "ERNIE-Speed-Pro-128K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0003,
		OutputPrice: 0.0006,
		RPM:         10000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(126976),
			model.WithModelConfigMaxInputTokens(126976),
			model.WithModelConfigMaxOutputTokens(4096),
		),
	},
	{
		Model:       "ERNIE-Lite-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0001,
		OutputPrice: 0.0001,
		RPM:         500,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(6144),
			model.WithModelConfigMaxInputTokens(6144),
			model.WithModelConfigMaxOutputTokens(2048),
		),
	},
	{
		Model:       "ERNIE-Lite-Pro-128K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0002,
		OutputPrice: 0.0004,
		RPM:         10000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(126976),
			model.WithModelConfigMaxInputTokens(126976),
			model.WithModelConfigMaxOutputTokens(4096),
			model.WithModelConfigToolChoice(true),
		),
	},
	{
		Model:       "ERNIE-Tiny-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0001,
		OutputPrice: 0.0001,
		RPM:         10000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(6144),
			model.WithModelConfigMaxInputTokens(6144),
			model.WithModelConfigMaxOutputTokens(2048),
		),
	},
	{
		Model:       "ERNIE-Character-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0003,
		OutputPrice: 0.0006,
		RPM:         60,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(6144),
			model.WithModelConfigMaxInputTokens(6144),
			model.WithModelConfigMaxOutputTokens(2048),
		),
	},
	{
		Model:       "ERNIE-Character-Fiction-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.0003,
		OutputPrice: 0.0006,
		RPM:         300,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(5120),
			model.WithModelConfigMaxInputTokens(5120),
			model.WithModelConfigMaxOutputTokens(2048),
		),
	},
	{
		Model:       "ERNIE-Novel-8K",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerBaidu,
		InputPrice:  0.04,
		OutputPrice: 0.12,
		RPM:         60,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(6144),
			model.WithModelConfigMaxInputTokens(6144),
			model.WithModelConfigMaxOutputTokens(2048),
		),
	},

	{
		Model:       "DeepSeek-V3",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerDeepSeek,
		InputPrice:  0.0008,
		OutputPrice: 0.0016,
		RPM:         1000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(64000),
			model.WithModelConfigMaxOutputTokens(8192),
		),
	},
	{
		Model:       "DeepSeek-R1",
		Type:        relaymode.ChatCompletions,
		Owner:       model.ModelOwnerDeepSeek,
		InputPrice:  0.002,
		OutputPrice: 0.008,
		RPM:         1000,
		Config: model.NewModelConfig(
			model.WithModelConfigMaxContextTokens(64000),
			model.WithModelConfigMaxOutputTokens(8192),
		),
	},
}

Functions

This section is empty.

Types

type Adaptor

type Adaptor struct{}

func (*Adaptor) ConvertRequest

func (a *Adaptor) ConvertRequest(meta *meta.Meta, req *http.Request) (string, http.Header, io.Reader, error)

func (*Adaptor) DoRequest

func (a *Adaptor) DoRequest(_ *meta.Meta, _ *gin.Context, req *http.Request) (*http.Response, error)

func (*Adaptor) DoResponse

func (a *Adaptor) DoResponse(meta *meta.Meta, c *gin.Context, resp *http.Response) (usage *relaymodel.Usage, err *relaymodel.ErrorWithStatusCode)

func (*Adaptor) GetBaseURL

func (a *Adaptor) GetBaseURL() string

func (*Adaptor) GetChannelName

func (a *Adaptor) GetChannelName() string

func (*Adaptor) GetModelList

func (a *Adaptor) GetModelList() []*model.ModelConfig

func (*Adaptor) GetRequestURL

func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error)

func (*Adaptor) SetupRequestHeader

func (a *Adaptor) SetupRequestHeader(meta *meta.Meta, _ *gin.Context, req *http.Request) error

type TokenResponse

type TokenResponse struct {
	ExpireTime time.Time `json:"expireTime"`
	Token      string    `json:"token"`
}

func GetBearerToken

func GetBearerToken(ctx context.Context, apiKey string) (*TokenResponse, error)

Jump to

Keyboard shortcuts

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