Skip to content

wflixu/Xcode-AI-Proxy

 
 

Repository files navigation

Xcode AI Proxy

解决 Xcode 中无法直接添加智谱 GLM、Kimi 和 DeepSeek 模型的问题。

解决什么问题?

当你在 Xcode 中尝试添加智谱、Kimi 或 DeepSeek AI 提供商时,会遇到:

  • ❌ "Provider is not valid"
  • ❌ "Models could not be fetched with the provided account details"

这个代理服务让你可以在 Xcode 中正常使用智谱 GLM-4.6、Kimi 和 DeepSeek 模型。

使用方法

⚠️⚠️⚠️ 确保你已安装 Python 3.12 + ⚠️⚠️⚠️

1. 配置 API 密钥

复制 .env.example.env,填入你的 API 密钥:

# 智谱AI API 密钥 (从 https://open.bigmodel.cn/ 获取)
ZHIPU_API_KEY=你的智谱API密钥

# Kimi API 密钥 (从 https://platform.moonshot.cn/ 获取)
KIMI_API_KEY=你的Kimi API密钥

# DeepSeek API 密钥 (从 https://platform.deepseek.com/ 获取)
DEEPSEEK_API_KEY=你的DeepSeek API密钥

2. 启动服务

项目已经提供 start.sh 启动脚本,会自动完成依赖安装、虚拟环境配置并启动服务。

chmod +x start.sh   # 首次使用时赋予执行权限
./start.sh

服务启动在 http://localhost:8899

3. 配置 Xcode

3.1 在 Internet Hosted 中添加 AI 提供商:

  • Base URL: http://localhost:8899
  • API Key: any-string-works (任意字符串)

3.2 在 Locally Hosted 中添加 端口:

  • 端口: 8899

现在可以在 Xcode 中正常使用智谱 GLM-4.6、Kimi 和 DeepSeek 模型了!

支持的模型

  • glm-4.6 - 智谱 AI GLM-4.6
  • kimi-k2-0905-preview - Kimi K2
  • deepseek-reasoner - DeepSeek Reasoner (思维模式)
  • deepseek-chat - DeepSeek Chat (对话模式)

常见问题

Q: 服务启动失败? A: 检查是否正确设置了 API 密钥,确保 8899 端口未被占用

Q: Xcode 还是连不上? A: 确认服务正在运行,Base URL 填写正确:http://localhost:8899或端口填写正确:8899

Q: Python 版本需要什么依赖? A: 需要 Python 3.10+,依赖已列在 pyproject.toml 中,需要 python 包管理工具 uv

致谢:

About

Xcode AI Proxy - Python 版本,解决 Xcode 中无法直接添加智谱 GLM、Kimi 和 DeepSeek 模型的问题

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.4%
  • Shell 7.6%