Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: hope to add an option for a unified interface, where we can input a centralized address like one-api for redirection. #4614

Open
Mgrsc opened this issue May 4, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@Mgrsc
Copy link

Mgrsc commented May 4, 2024

Problem Description

hope to add an option for a unified interface, where we can input a centralized address like one-api for redirection.

Solution Description

Add a unified URL entry option for transit (new-api, one-api) to facilitate use after passing through intermediaries like Claude or Gemini.

Alternatives Considered

No response

Additional Context

No response

@Mgrsc Mgrsc added the enhancement New feature or request label May 4, 2024
@Dean-YZG
Copy link
Contributor

Dean-YZG commented May 6, 2024

Can you describe the usage scenario of the function and the specific problem solved?

@muaxb
Copy link

muaxb commented May 6, 2024

I have also encountered a similar scenario, and I will describe the specific requirements in detail: It is necessary to add a parameter to control whether the selected model must use a third-party custom interface. For example, I own a third-party proxy interface address (which includes custom features like quotas and other custom functions). This interface address has been implemented and unified all other model interfaces, such as integrating OpenAI, Claude, Gemini, etc., with the unified interface format being OpenAI's standard format. Now when I use the Claude model, I want it to go through my customized third-party proxy interface instead of calling the model's own API. Currently, I have to modify the code in api.ts to meet my needs, and the comments are the modified code.

constructor(provider: ModelProvider = ModelProvider.GPT) {
switch (provider) {
case ModelProvider.GeminiPro:
this.llm = new GeminiProApi();
break;
case ModelProvider.Claude:
this.llm = new ChatGPTApi();
// this.llm = new ClaudeApi();
break;
default:
this.llm = new ChatGPTApi();
}
}

我也碰到过相关场景,我大概描述一下具体的需求:需要增加一个 参数 来控制 选用模型是否强制使用第三方自定义接口
比如我拥有一个第三方代理接口地址(里面自定义了额度等其他自定义功能),这个接口地址已经实现并统一了所有的其他模型接口,比如集成 opnenai、claude、gemini等模型,统一接口格式为openai的标准格式。
现在我调用 claude 模型,我希望走的是我自定义的第三方代理接口而不是调用本身模型相关的API,

当前情况下,我不得不修改 api.ts 里面的这段代码来实现我的需求,注释是修改过的代码

constructor(provider: ModelProvider = ModelProvider.GPT) {
switch (provider) {
case ModelProvider.GeminiPro:
this.llm = new GeminiProApi();
break;
case ModelProvider.Claude:
this.llm = new ChatGPTApi();
// this.llm = new ClaudeApi();
break;
default:
this.llm = new ChatGPTApi();
}
}

@QAbot-zh
Copy link

QAbot-zh commented May 6, 2024

如果能实现类似效果的话,也不失为一种解决方案:

  constructor(provider: ModelProvider = ModelProvider.GPT) {
    //通过环境变量选择按原始路由进行请求,还是按OpenAI的标准格式请求
    //readSomeEnvConfig() 是假想的函数
    const chatGeminiThroughOpenai = readSomeEnvConfig();
    const chatClaudeThroughOpenai = readSomeEnvConfig();
  
    switch (provider) {
      case ModelProvider.GeminiPro:
        if (chatGeminiThroughOpenai){
          this.llm = new ChatGPTApi();
        }
        else{
          this.llm = new GeminiProApi();
        }
        break;
      case ModelProvider.Claude:
        if (chatClaudeThroughOpenai){
          this.llm = new ChatGPTApi();
        }
        else{
          this.llm = new ClaudeApi();
        }
        break;
      default:
        this.llm = new ChatGPTApi();
    }
  }

@Mgrsc
Copy link
Author

Mgrsc commented May 6, 2024

Can you describe the usage scenario of the function and the specific problem solved?

As mentioned by the individuals below, there is a request to add a field where one can input the URL of intermediary servers (such as one-api, new-api, etc.) in order to request all models through the URL addresses of these intermediary servers. This includes not only OpenAI's models but also other models like Claude.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants