• 请不要在回答技术问题时复制粘贴 AI 生成的内容
zapll
V2EX  ›  程序员

教程 - GPT-5-Codex 自定义模型供应商使用 OpenAI 最新编程模型的配置方式

  •  
  •   zapll · Sep 16, 2025 · 9142 views
    This topic created in 256 days ago, the information mentioned may be changed or developed.

    1. 安装 Codex 最新版 v0.36.0

    npm install -g @openai/codex@latest
    

    2. 设置 ~/.codex/config.yaml

    disable_response_storage = true  
    preferred_auth_method = "apikey"  
    model = "gpt-5-codex"
    model_provider = "local_openai"  
      
    [model_providers.local_openai]  
    name = "Local OpenAI"  
    base_url = "https://aicoding.sh/v1"  
    env_key = "OPENAI_API_KEY"  # 关键:指定环境变量  
    wire_api = "responses"      # 使用 responses 接口  
    requires_openai_auth = false
    

    3. 设置环境变量

    export OPENAI_API_KEY=aicoding-xxxxxx  #替换为你自己的 key
    

    aicoding.sh 的 api token 可以同时在 codex 和 claude code 中使用

    4. 进入 Codex 切换模型

    Imgur

    6 replies    2025-09-26 10:13:12 +08:00
    AlphabetRanger
        1
    AlphabetRanger  
       Sep 16, 2025
    感谢 op
    siyangyuan
        2
    siyangyuan  
       Sep 16, 2025
    op 您好,如果我想在 vscode 里面的插件进行更改模型的话,应该如何操作~
    muyeyong
        3
    muyeyong  
       Sep 16, 2025
    使用了 gpt-5-codex 太慢了,运行了快一个小时,然后告诉我改不了。。。
    owen800q
        4
    owen800q  
       Sep 16, 2025 via iPhone
    @siyangyuan 不支持
    nunterr
        5
    nunterr  
       Sep 18, 2025
    如果本地电脑已经安装 chatgpt 客户端,这个安装更方便,只需要第一步

    npm install -g @openai/codex


    https://chatgpt.com/codex

    后面的都会自动识别,输入 codex 就可以正常使用了
    mymail6811
        6
    mymail6811  
       Sep 26, 2025
    能在运行到一半发现没钱了然后换 provider 吗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 19:19 · PVG 03:19 · LAX 12:19 · JFK 15:19
    ♥ Do have faith in what you're doing.