| 1234567891011121314151617181920212223242526 |
- package controller
- import (
- "github.com/gin-gonic/gin"
- "github.com/labring/aiproxy/core/model"
- "github.com/labring/aiproxy/core/relay/adaptor/openai"
- "github.com/labring/aiproxy/core/relay/utils"
- )
- func GetEmbedRequestPrice(_ *gin.Context, mc model.ModelConfig) (model.Price, error) {
- return mc.Price, nil
- }
- func GetEmbedRequestUsage(c *gin.Context, _ model.ModelConfig) (model.Usage, error) {
- textRequest, err := utils.UnmarshalGeneralOpenAIRequest(c.Request)
- if err != nil {
- return model.Usage{}, err
- }
- return model.Usage{
- InputTokens: model.ZeroNullInt64(openai.CountTokenInput(
- textRequest.Input,
- textRequest.Model,
- )),
- }, nil
- }
|