AveMujicaAPI 接入codex流程

Codex APP 正常使用环节需要科学上网环境,需注意

AveMujicaAPI 注册

  1. 通过我个人的邀请链接https://api.avemujica.moe/sign-up?aff=3X69 注册API,aff邀请链接无明确收益,仅作统计😋
  2. 通过控制台平台-个人-钱包-进行氪金
    Pasted image 20260522120621.png
  3. 在API密钥条目中,右上角点击创建API密钥,键入任意名称,分组选为default,并将APIkey保存下来,注意不要泄露自己的key,防止其他人盗用
    Pasted image 20260522120751.png

codex 安装

  1. 在windows环境下,复制以下代码在 PowerShell 中运行,脚本会安装 Codex CLI,备份已有 .codex\config.toml 和 .codex\auth.json,再写入 AveMujicaAPI provider。PowerShell可通过win+x,选择终端管理员powershell管理员模式启动,脚本运行过程中需要填入一次前文所要求保留的APIkey
     $SecureKey = Read-Host "AveMujicaAPI API Key" -AsSecureString
     $Bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureKey)
     $ApiKey = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($Bstr)
     [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($Bstr)
     
     $Model = Read-Host "Model ID [gpt-5.5]"
     if ([string]::IsNullOrWhiteSpace($Model)) {
       $Model = "gpt-5.5"
     }
     
     if ([string]::IsNullOrWhiteSpace($ApiKey)) {
       throw "API Key is required."
     }
     
     npm install -g @openai/codex
     
     $CodexDir = Join-Path $env:USERPROFILE ".codex"
     New-Item -ItemType Directory -Force -Path $CodexDir | Out-Null
     
     $Stamp = Get-Date -Format "yyyyMMddHHmmss"
     $ConfigPath = Join-Path $CodexDir "config.toml"
     $AuthPath = Join-Path $CodexDir "auth.json"
     
     if (Test-Path $ConfigPath) {
       Copy-Item $ConfigPath "$ConfigPath.bak.$Stamp"
     }
     if (Test-Path $AuthPath) {
       Copy-Item $AuthPath "$AuthPath.bak.$Stamp"
     }
     
     @"
     model_provider = "avemujicaapi"
     model = "$Model"
     model_reasoning_effort = "xhigh"
     disable_response_storage = true
     
     [model_providers.avemujicaapi]
     name = "AveMujicaAPI"
     base_url = "https://api.avemujica.moe/v1"
     requires_openai_auth = true
     stream_idle_timeout_ms = 600000
     wire_api = "responses"
     "@ | Set-Content -Encoding UTF8 $ConfigPath
     
     @{ OPENAI_API_KEY = $ApiKey } | ConvertTo-Json | Set-Content -Encoding UTF8 $AuthPath
     
     codex --version
    

    Pasted image 20260522121309.png

    2. 安装codex app,下载链接。安装后,通过之前的步骤要求的apikey登录即可开始正常使用。
暂无评论

发送评论 编辑评论


				
上一篇