OpenCode系列---【OpenCode接入白山智算模板】

1.白山智算api

如果你还在为token费用高而发愁,那么你可以先体验一把白山智算家推出的活动,注册实名制后,就送150元的额度,2026年3月15号之前,首次调用就再送300元,这样下来就送450元了,且额度永久不失效,如果你还觉得不够,你可以通过邀请,邀请一个则送200元,包括MiniMax-M2.5,GLM5等。这个是我目前发现的最有诚意的大模型api三方平台了。注册链接为:https://ai.baishan.com/auth/login?referralCode=TAwCe8f1hp。

2.OpenCode接入白山智算模板

C:\Users\<用户名>\.config\opencode\opencode.json这个json,替换成下面的即可。

复制代码
{
    "$schema": "https://opencode.ai/config.json",
    "provider": {
        "baishan": {
            "npm": "@ai-sdk/anthropic",
		"name": "白山智算",
            "options": {
                "baseURL": "https://api.edgefn.net/v1",
                "apiKey": "替换成你自己的api秘钥"
            },
            "models": {
                "MiniMax-M2.5": {
                    "name": "MiniMax M2.5",
                    "modalities": {
                        "input": ["text"],
                        "output": ["text"]
                    },
                    "options": {
                        "thinking": {
                            "type": "enabled",
                            "budgetTokens": 8192
                        }
                    },
                    "limit": {
                        "context": 196608,
                        "output": 24576
                    }
                },
                "GLM-5": {
                    "name": "GLM-5",
                    "modalities": {
                        "input": ["text"],
                        "output": ["text"]
                    },
                    "options": {
                        "thinking": {
                            "type": "enabled",
                            "budgetTokens": 8192
                        }
                    },
                    "limit": {
                        "context": 202752,
                        "output": 16384
                    }
                },
                "GLM-4.7": {
                    "name": "GLM-4.7",
                    "modalities": {
                        "input": ["text"],
                        "output": ["text"]
                    },
                    "options": {
                        "thinking": {
                            "type": "enabled",
                            "budgetTokens": 8192
                        }
                    },
                    "limit": {
                        "context": 202752,
                        "output": 16384
                    }
                },
                "Kimi-K2-Instruct": {
                    "name": "Kimi-K2-Instruct",
                    "modalities": {
                        "input": ["text", "image"],
                        "output": ["text"]
                    },
                    "options": {
                        "thinking": {
                            "type": "enabled",
                            "budgetTokens": 8192
                        }
                    },
                    "limit": {
                        "context": 262144,
                        "output": 32768
                    }
                }
            }
        }
    }
}