GPT 模型按 gpt- → spt-,OpenRouter 直接填 openrouter-free。
桌面客户端
创建 API KeyCursor
半自动:引导 Add Custom Model(spt-* 与 openrouter-free)
Base URL
https://api.4stoken.cn鉴权方式
Authorization: Bearer sk-...协议
/v1/chat/completionsDownload
下载安装教程
先安装工具本体,再运行 4SToken 配置脚本。Windows 与 macOS / Linux 分开操作。
安装前准备
准备已安装 Cursor
准备已创建 Portal Client Key
准备准备一个可用模型,如 spt-5.5 或 openrouter-free
Windows
1下载 Windows 安装包并完成安装
2运行本页 PowerShell 向导,记录 Base URL、Key、模型名
3进入 Settings → Cursor Settings → Models,填入 Override OpenAI Base URL:https://api.4stoken.cn/v1
4Add Custom Model 填入 spt-* 或 openrouter-free
macOS / Linux
1macOS 下载 dmg,Linux 下载 AppImage 或发行版包
2运行本页 bash 向导,记录 Base URL、Key、模型名
3进入 Models 设置,填入 Override OpenAI Base URL:https://api.4stoken.cn/v1
4Add Custom Model 填入 spt-* 或 openrouter-free
Install
配置命令
将命令中的 YOUR_API_KEY 替换成你的 Client Key。
macOS / Linux
curl -fsSL https://4stoken.cn/docs/scripts/cursor.sh | GATEWAY_BASE_URL='https://api.4stoken.cn' bash -s -- YOUR_API_KEY
Windows PowerShell
$f = Join-Path $env:TEMP 'cursor.ps1'; Invoke-WebRequest -Uri 'https://4stoken.cn/docs/scripts/cursor.ps1' -OutFile $f -UseBasicParsing; powershell -NoProfile -ExecutionPolicy Bypass -File $f -ApiKey YOUR_API_KEY
Verify
配置检查
按顺序检查:先测接口连通,再做模拟调用,最后回到具体软件核对配置是否真正生效。
连通性检查
先确认 Key、Base URL 与模型列表接口可达。
执行模型列表查询,确认返回 200 且能看到可用模型
curl https://api.4stoken.cn/v1/models -H "Authorization: Bearer YOUR_API_KEY"
模拟调用
绕开客户端先打一次最小请求,确认网关协议与模型路由正确。
执行最小请求,确认没有 401、403、404、模型不存在或无路由错误
curl https://api.4stoken.cn/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d "{\"model\":\"openrouter-free\",\"messages\":[{\"role\":\"user\",\"content\":\"hello\"}]}"其他
回到具体软件内确认配置文件、界面设置或重启步骤已经生效。
Cursor 中新建一次 Ask / Agent 请求
确认 Override OpenAI Base URL、Custom Model 与返回内容一致
Models
支持的模型 code
客户端填写系统实际模型协议说明
spt-5.5gpt-5.5/v1/chat/completionsAdd Custom Model 填 spt 别名spt-5.4gpt-5.4/v1/chat/completionsAdd Custom Model 填 spt 别名spt-5.4-minigpt-5.4-mini/v1/chat/completions轻量 GPT 档位openrouter-freeopenrouter-free/v1/chat/completionsOpenRouter 直接填 modelCode 以上列表来自 Portal 已发布模型;客户端里优先填写表格第一列。完整可用范围仍以 GET /v1/models 与「模型与价格」页为准。
Notes
接入边界
- 脚本仅修改本机工具配置文件,可通过上方源码链接审计。
- 执行前可设置
GATEWAY_BASE_URL覆盖默认网关地址。 - 该工具需要在客户端内完成最终确认或 Add Custom Model。
GET /v1/realtime未开放,不影响编程工具接入。
