在 Oh My Pi 中使用 PingToken
Oh My Pi 是终端 AI 编程 Agent。自 v14.5 起内置了 DeepSeek V4 模型条目,但内置条目缺少关键配置,直接使用可能报错,仍需自定义 models.yml。
前置条件
安装 Oh My Pi:https://github.com/can1357/oh-my-pi#installation
从 控制台 → Token 管理 获取 API Token:
export PINGTOKEN_API_KEY=<你的 API Token>
配置
创建 ~/.omp/agent/models.yml:
providers:
pingtoken:
baseUrl: https://pingtoken.cn/api/v1
api: openai-completions
apiKey: PINGTOKEN_API_KEY
authHeader: true
models:
- id: deepseek-v4-pro
name: DeepSeek V4 Pro
reasoning: true
thinking:
minLevel: high
maxLevel: xhigh
mode: effort
input: [text]
contextWindow: 1000000
maxTokens: 384000
compat:
supportsDeveloperRole: false
supportsReasoningEffort: true
maxTokensField: max_tokens
reasoningEffortMap:
high: high
xhigh: max
supportsToolChoice: false
requiresReasoningContentForToolCalls: true
requiresAssistantContentForToolCalls: true
extraBody:
thinking:
type: enabled
- id: deepseek-v4-flash
name: DeepSeek V4 Flash
reasoning: true
thinking:
minLevel: high
maxLevel: xhigh
mode: effort
input: [text]
contextWindow: 1000000
maxTokens: 384000
compat:
supportsDeveloperRole: false
supportsReasoningEffort: true
maxTokensField: max_tokens
reasoningEffortMap:
high: high
xhigh: max
supportsToolChoice: false
requiresReasoningContentForToolCalls: true
requiresAssistantContentForToolCalls: true
extraBody:
thinking:
type: enabled
配置要点
基础
| 字段 | 说明 |
|---|---|
baseUrl: https://pingtoken.cn/api/v1 | PingToken OpenAI 兼容接口。不要加 /v1。 |
authHeader: true | 发送 Authorization: Bearer $PINGTOKEN_API_KEY。 |
supportsDeveloperRole: false | 以 system 角色发系统提示词。 |
maxTokensField: max_tokens | PingToken 的输出限制字段是 max_tokens。 |
Thinking(思考模式)
| 字段 | 说明 |
|---|---|
thinking.mode: effort | 使用 effort-based thinking。 |
thinking.minLevel: high / maxLevel: xhigh | 限制为 DeepSeek 支持的两档。 |
reasoningEffortMap | OMP 的 xhigh 映射为 DeepSeek 的 max。 |
extraBody.thinking.type: enabled | 显式启用 DeepSeek V4 思考模式。 |
使用
cd /path/to/your-project
omp --model pingtoken/deepseek-v4-pro
需要更快响应时:
omp --model pingtoken/deepseek-v4-flash
在 Oh My Pi 内输入 /model 或按 Ctrl+L 切换模型。
已知问题
- 不推荐依赖内置模型条目。 较新版本
omp --list-models pingtoken能列出模型,但内置条目缺少关键 compat。直接用内置条目在 thinking mode 下带 tool call 的长对话大概率报错。始终使用上方的models.yml配置。 - Oh My Pi 目前没有 PingToken 的 OAuth
/login入口。只能通过PINGTOKEN_API_KEY环境变量或models.yml中的apiKey字段配置 API Token。