Transformers documentation

Cursor

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v5.24.0).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Cursor

Cursor 是一款 AI 驱动的代码编辑器,提供 Sonnet、Gemini 和 GPT 等模型。请启用 CORS 以提供本地模型(出于安全考虑,默认情况下已禁用)。

transformers serve --enable-cors

Cursor 需要一个公共地址才能访问您的本地服务器。请使用 ngrok 创建隧道。注册、完成身份验证,然后运行此命令。

ngrok http localhost:8000

打开 Cursor,前往 Settings > Cursor Settings > Models > API Keys。

  1. 取消列表中所有模型的选中状态。
  2. 添加您所需的模型(Qwen/Qwen3-4B)。
  3. 在 OpenAI API Key 字段中输入任意文本(必填)。
  4. 将 ngrok 转发地址粘贴到 Override OpenAI Base URL 中。在 URL 末尾添加 /v1(https://…ngrok-free.app/v1)。
  5. 点击 Verify。

您的模型已准备就绪。

Update on GitHub