How to add CrofAI to OpenCode

Follow these steps to integrate CrofAI into OpenCode.

1. Configure the Model

Below is the configuration based on the currently available models. Add this to your opencode.json or opencode.jsonc file:

Dont forget too add api key in auth.json. Read more about providers in OpenCodes documentation.
https://opencode.ai/docs/providers/

 "provider": {
    "crofai": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "CrofAI",
      "options": {
        "baseURL": "https://crof.ai/v1"
      },
      "models": {
        "glm-5.1": {
          "name": "GLM 5.1",
          "attachment": true,
          "reasoning": true
        },
        "glm-5.1-precision": {
          "name": "GLM 5.1 Precision",
          "attachment": true,
          "reasoning": true
        },
        "greg": {
          "name": "Greg",
          "attachment": true,
          "reasoning": true
        },
        "kimi-k2.6": {
          "name": "Kimi K2.6",
          "attachment": true,
          "reasoning": true
        },
        "kimi-k2.6-precision": {
          "name": "Kimi K2.6 Precision",
          "attachment": true,
          "reasoning": true
        },
        "kimi-k2.5": {
          "name": "Kimi K2.5",
          "attachment": true,
          "reasoning": true
        },
        "kimi-k2.5-lightning": {
          "name": "Kimi K2.5 Lightning",
          "attachment": true,
          "reasoning": true
        },
        "glm-5": {
          "name": "GLM 5",
          "attachment": true,
          "reasoning": true
        },
        "glm-4.7": {
          "name": "GLM 4.7",
          "attachment": true,
          "reasoning": true
        },
        "glm-4.7-flash": {
          "name": "GLM 4.7 Flash",
          "attachment": true,
          "reasoning": true
        },
        "gemma-4-31b-it": {
          "name": "Gemma 4 31B IT",
          "attachment": true,
          "reasoning": true
        },
        "minimax-m2.5": {
          "name": "MiniMax M2.5",
          "attachment": true,
          "reasoning": true
        },
        "qwen3.5-397b-a17b": {
          "name": "Qwen3.5 397B A17B",
          "attachment": true,
          "reasoning": true
        },
        "qwen3.5-9b": {
          "name": "Qwen3.5 9B",
          "attachment": true,
          "reasoning": true
        },
        "qwen3.5-9b-chat": {
          "name": "Qwen3.5 9B Chat",
          "attachment": true,
          "reasoning": true
        },
        "deepseek-v3.2": {
          "name": "DeepSeek v3.2",
          "attachment": true,
          "reasoning": true
        }
      }
    }
  },

2. Add Your API Key

Insert your credentials into auth.json:

{
  "crofai": {
    "type": "api",
    "key": "YOUR_API_KEY"
  }
}

3. Documentation

For more details on providers and advanced configuration, visit the official documentation: opencode.ai/docs/providers

Marcus Skriven av: