mirror of
https://github.com/githubhjs/CLIProxyAPIPlus.git
synced 2026-07-12 01:25:13 +00:00
Merge pull request #93 from jc01rho/main
feat(config): add github-copilot support to oauth-model-mappings and oauth-excluded-models
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
name: docker-image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
|
|
||||||
env:
|
|
||||||
APP_NAME: CLIProxyAPI
|
|
||||||
DOCKERHUB_REPO: eceasy/cli-proxy-api-plus
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: Generate Build Metadata
|
|
||||||
run: |
|
|
||||||
echo VERSION=`git describe --tags --always --dirty` >> $GITHUB_ENV
|
|
||||||
echo COMMIT=`git rev-parse --short HEAD` >> $GITHUB_ENV
|
|
||||||
echo BUILD_DATE=`date -u +%Y-%m-%dT%H:%M:%SZ` >> $GITHUB_ENV
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: |
|
|
||||||
linux/amd64
|
|
||||||
linux/arm64
|
|
||||||
push: true
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ env.VERSION }}
|
|
||||||
COMMIT=${{ env.COMMIT }}
|
|
||||||
BUILD_DATE=${{ env.BUILD_DATE }}
|
|
||||||
tags: |
|
|
||||||
${{ env.DOCKERHUB_REPO }}:latest
|
|
||||||
${{ env.DOCKERHUB_REPO }}:${{ env.VERSION }}
|
|
||||||
+9
-1
@@ -215,7 +215,7 @@ ws-auth: false
|
|||||||
|
|
||||||
# Global OAuth model name mappings (per channel)
|
# Global OAuth model name mappings (per channel)
|
||||||
# These mappings rename model IDs for both model listing and request routing.
|
# These mappings rename model IDs for both model listing and request routing.
|
||||||
# Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro.
|
# Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
# NOTE: Mappings do not apply to gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, or ampcode.
|
# NOTE: Mappings do not apply to gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, or ampcode.
|
||||||
# oauth-model-mappings:
|
# oauth-model-mappings:
|
||||||
# gemini-cli:
|
# gemini-cli:
|
||||||
@@ -246,8 +246,12 @@ ws-auth: false
|
|||||||
# kiro:
|
# kiro:
|
||||||
# - name: "kiro-claude-opus-4-5"
|
# - name: "kiro-claude-opus-4-5"
|
||||||
# alias: "op45"
|
# alias: "op45"
|
||||||
|
# github-copilot:
|
||||||
|
# - name: "gpt-5"
|
||||||
|
# alias: "copilot-gpt5"
|
||||||
|
|
||||||
# OAuth provider excluded models
|
# OAuth provider excluded models
|
||||||
|
# Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
# oauth-excluded-models:
|
# oauth-excluded-models:
|
||||||
# gemini-cli:
|
# gemini-cli:
|
||||||
# - "gemini-2.5-pro" # exclude specific models (exact match)
|
# - "gemini-2.5-pro" # exclude specific models (exact match)
|
||||||
@@ -268,6 +272,10 @@ ws-auth: false
|
|||||||
# - "vision-model"
|
# - "vision-model"
|
||||||
# iflow:
|
# iflow:
|
||||||
# - "tstars2.0"
|
# - "tstars2.0"
|
||||||
|
# kiro:
|
||||||
|
# - "kiro-claude-haiku-4-5"
|
||||||
|
# github-copilot:
|
||||||
|
# - "raptor-mini"
|
||||||
|
|
||||||
# Optional payload configuration
|
# Optional payload configuration
|
||||||
# payload:
|
# payload:
|
||||||
|
|||||||
@@ -259,7 +259,8 @@ func performGeminiCLISetup(ctx context.Context, httpClient *http.Client, storage
|
|||||||
finalProjectID := projectID
|
finalProjectID := projectID
|
||||||
if responseProjectID != "" {
|
if responseProjectID != "" {
|
||||||
if explicitProject && !strings.EqualFold(responseProjectID, projectID) {
|
if explicitProject && !strings.EqualFold(responseProjectID, projectID) {
|
||||||
log.Warnf("Gemini onboarding returned project %s instead of requested %s; keeping requested project ID.", responseProjectID, projectID)
|
log.Warnf("Gemini onboarding returned project %s instead of requested %s; using response project ID.", responseProjectID, projectID)
|
||||||
|
finalProjectID = responseProjectID
|
||||||
} else {
|
} else {
|
||||||
finalProjectID = responseProjectID
|
finalProjectID = responseProjectID
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,11 +96,12 @@ type Config struct {
|
|||||||
AmpCode AmpCode `yaml:"ampcode" json:"ampcode"`
|
AmpCode AmpCode `yaml:"ampcode" json:"ampcode"`
|
||||||
|
|
||||||
// OAuthExcludedModels defines per-provider global model exclusions applied to OAuth/file-backed auth entries.
|
// OAuthExcludedModels defines per-provider global model exclusions applied to OAuth/file-backed auth entries.
|
||||||
|
// Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
OAuthExcludedModels map[string][]string `yaml:"oauth-excluded-models,omitempty" json:"oauth-excluded-models,omitempty"`
|
OAuthExcludedModels map[string][]string `yaml:"oauth-excluded-models,omitempty" json:"oauth-excluded-models,omitempty"`
|
||||||
|
|
||||||
// OAuthModelMappings defines global model name mappings for OAuth/file-backed auth channels.
|
// OAuthModelMappings defines global model name mappings for OAuth/file-backed auth channels.
|
||||||
// These mappings affect both model listing and model routing for supported channels:
|
// These mappings affect both model listing and model routing for supported channels:
|
||||||
// gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow.
|
// gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
//
|
//
|
||||||
// NOTE: This does not apply to existing per-credential model alias features under:
|
// NOTE: This does not apply to existing per-credential model alias features under:
|
||||||
// gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, and ampcode.
|
// gemini-api-key, codex-api-key, claude-api-key, openai-compatibility, vertex-api-key, and ampcode.
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ func modelMappingChannel(auth *Auth) string {
|
|||||||
// and auth kind. Returns empty string if the provider/authKind combination doesn't support
|
// and auth kind. Returns empty string if the provider/authKind combination doesn't support
|
||||||
// OAuth model mappings (e.g., API key authentication).
|
// OAuth model mappings (e.g., API key authentication).
|
||||||
//
|
//
|
||||||
// Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow.
|
// Supported channels: gemini-cli, vertex, aistudio, antigravity, claude, codex, qwen, iflow, kiro, github-copilot.
|
||||||
func OAuthModelMappingChannel(provider, authKind string) string {
|
func OAuthModelMappingChannel(provider, authKind string) string {
|
||||||
provider = strings.ToLower(strings.TrimSpace(provider))
|
provider = strings.ToLower(strings.TrimSpace(provider))
|
||||||
authKind = strings.ToLower(strings.TrimSpace(authKind))
|
authKind = strings.ToLower(strings.TrimSpace(authKind))
|
||||||
@@ -165,7 +165,7 @@ func OAuthModelMappingChannel(provider, authKind string) string {
|
|||||||
return "codex"
|
return "codex"
|
||||||
case "gemini-cli", "aistudio", "antigravity", "qwen", "iflow":
|
case "gemini-cli", "aistudio", "antigravity", "qwen", "iflow":
|
||||||
return provider
|
return provider
|
||||||
case "kiro":
|
case "kiro", "github-copilot":
|
||||||
return provider
|
return provider
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
@@ -769,6 +769,7 @@ func (s *Service) registerModelsForAuth(a *coreauth.Auth) {
|
|||||||
models = applyExcludedModels(models, excluded)
|
models = applyExcludedModels(models, excluded)
|
||||||
case "iflow":
|
case "iflow":
|
||||||
models = registry.GetIFlowModels()
|
models = registry.GetIFlowModels()
|
||||||
|
models = applyExcludedModels(models, excluded)
|
||||||
case "github-copilot":
|
case "github-copilot":
|
||||||
models = registry.GetGitHubCopilotModels()
|
models = registry.GetGitHubCopilotModels()
|
||||||
models = applyExcludedModels(models, excluded)
|
models = applyExcludedModels(models, excluded)
|
||||||
|
|||||||
Reference in New Issue
Block a user