[PR #9057] fix(provider): normalize model API IDs with slashes for abacus compatibility #12966

Closed
opened 2026-02-16 18:17:51 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9057

State: closed
Merged: No


Fixes #8780

Summary

Models with slashes in their IDs (e.g., `deepseek-ai/DeepSeek-V3.2`) were not working correctly with providers like abacus that use `org/model` naming conventions. The models would output raw commands instead of executing them.

Root Cause

When users configure models using the full slug as the model key (e.g., `"deepseek-ai/DeepSeek-V3.2"`), the `api.id` field was set to the full slug including the organization prefix. This caused issues with:

  1. The AI SDK not correctly parsing model IDs with `/`
  2. The abacus API expecting model IDs without the organization prefix

Solution

Added a `normalizeModelAPIID()` helper function that:

  • Extracts only the model name from `org/model` format for API calls
  • Preserves the full identifier for internal lookups
  • Only applies when no explicit `id` field is provided (maintains backward compatibility)

Changes

  • packages/opencode/src/provider/provider.ts: Add normalization logic
  • packages/opencode/test/provider/provider.test.ts: Add comprehensive test coverage

Example Behavior

{
  "provider": {
    "abacus": {
      "models": {
        "deepseek-ai/DeepSeek-V3.2": {
          "name": "DeepSeek V3.2"
        }
      }
    }
  }
}

Result:

  • `model.id` = `"deepseek-ai/DeepSeek-V3.2"` (used for internal lookups)
  • `model.api.id` = `"DeepSeek-V3.2"` (used for API calls)

Test Coverage

Added tests for:

  • Models with single slash: `deepseek-ai/DeepSeek-V3.2`
  • Models with multiple slashes: `Qwen/Qwen2.5-72B-Instruct`
  • Verification that internal IDs preserve full identifier
  • Verification that API IDs are correctly normalized

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9057 **State:** closed **Merged:** No --- Fixes #8780 ## Summary Models with slashes in their IDs (e.g., \`deepseek-ai/DeepSeek-V3.2\`) were not working correctly with providers like abacus that use \`org/model\` naming conventions. The models would output raw commands instead of executing them. ## Root Cause When users configure models using the full slug as the model key (e.g., \`"deepseek-ai/DeepSeek-V3.2"\`), the \`api.id\` field was set to the full slug including the organization prefix. This caused issues with: 1. The AI SDK not correctly parsing model IDs with \`/\` 2. The abacus API expecting model IDs without the organization prefix ## Solution Added a \`normalizeModelAPIID()\` helper function that: - Extracts only the model name from \`org/model\` format for API calls - Preserves the full identifier for internal lookups - Only applies when no explicit \`id\` field is provided (maintains backward compatibility) ## Changes - **packages/opencode/src/provider/provider.ts**: Add normalization logic - **packages/opencode/test/provider/provider.test.ts**: Add comprehensive test coverage ## Example Behavior ```json { "provider": { "abacus": { "models": { "deepseek-ai/DeepSeek-V3.2": { "name": "DeepSeek V3.2" } } } } } ``` Result: - \`model.id\` = \`"deepseek-ai/DeepSeek-V3.2"\` (used for internal lookups) - \`model.api.id\` = \`"DeepSeek-V3.2"\` (used for API calls) ## Test Coverage Added tests for: - Models with single slash: \`deepseek-ai/DeepSeek-V3.2\` - Models with multiple slashes: \`Qwen/Qwen2.5-72B-Instruct\` - Verification that internal IDs preserve full identifier - Verification that API IDs are correctly normalized 🤖 Generated with [Claude Code](https://claude.com/claude-code)
yindo added the pull-request label 2026-02-16 18:17:51 -05:00
yindo closed this issue 2026-02-16 18:17:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12966