Use modelos do Alibaba Cloud Model Studio no OpenCode.
Início rápido
- 1
Conecte o provedor
Executeopencode, digite/connect, selecione o provedor do seu plano de cobrança e insira a chave de API:- Token Plan
- Pagamento conforme o uso
- Coding Plan
Selecione Alibaba Token Plan (China) e insira a chave de API do Token Plan da sua edição:- Token Plan Personal Edition: Criar ou visualizar API Key
- Token Plan Team Edition: Atribuir assento e obter API Key
Selecione Alibaba (China) e insira uma chave de API do Model Studio.Selecione Alibaba Coding Plan (China) e insira uma chave de API do Coding Plan. - 2
Selecione um modelo
Digite/modelse selecione o modelo desejado. - 3
Verifique
Execute o comando a seguir para verificar:Copyopencode run "Hello"
Configurar com um arquivo de configuração
Além das opções acima, você também pode se conectar usando um arquivo de configuração.- 1
Abra ou crie o arquivo de configuração
- macOS / Linux:
~/.config/opencode/opencode.json - Windows:
C:\Users\<username>\.config\opencode\opencode.json
- macOS / Linux:
- 2
Escreva a configuração
SubstituaYOUR_API_KEYpela chave de API do seu plano.- Token Plan — Edição Pessoal
- Token Plan — Edição para Equipes
- Pagamento conforme o uso
- Coding Plan
Copy{ "$schema": "https://opencode.ai/config.json", "provider": { "bailian-token-plan": { "npm": "@ai-sdk/anthropic", "name": "Alibaba Cloud Model Studio", "options": { "baseURL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1", "apiKey": "YOUR_API_KEY" }, "models": { "auto": { "name": "Auto", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 393216 } }, "qwen4-max-preview": { "name": "Qwen4.0 Max Preview", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "qwen4-max": { "name": "Qwen4 Max", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 262144 } }, "qwen3.8-max": { "name": "Qwen3.8 Max", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "qwen3.8-flash": { "name": "Qwen3.8 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "qwen3.7-max": { "name": "Qwen3.7 Max", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "qwen3.7-plus": { "name": "Qwen3.7 Plus", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "qwen3.6-flash": { "name": "Qwen3.6 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4.1-flash-1017": { "name": "DeepSeek V4.1 Flash 1017", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4-pro": { "name": "DeepSeek V4 Pro", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4-pro-0813": { "name": "DeepSeek V4 Pro 0813", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4-flash-0731": { "name": "DeepSeek V4 Flash 0731", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "glm-5.3": { "name": "GLM-5.3", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 202752, "output": 16384 } }, "glm-5.2": { "name": "GLM-5.2", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 202752, "output": 16384 } } } } } }Copy{ "$schema": "https://opencode.ai/config.json", "provider": { "bailian-token-plan": { "npm": "@ai-sdk/anthropic", "name": "Alibaba Cloud Model Studio", "options": { "baseURL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1", "apiKey": "YOUR_API_KEY" }, "models": { "auto": { "name": "Auto", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 393216 } }, "qwen4-max-preview": { "name": "Qwen4.0 Max Preview", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "qwen4-max": { "name": "Qwen4 Max", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 262144 } }, "qwen3.8-max": { "name": "Qwen3.8 Max", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "qwen3.8-flash": { "name": "Qwen3.8 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "qwen3.7-max": { "name": "Qwen3.7 Max", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "qwen3.7-plus": { "name": "Qwen3.7 Plus", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "qwen3.6-plus": { "name": "Qwen3.6 Plus", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "qwen3.6-flash": { "name": "Qwen3.6 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4.1-flash-1017": { "name": "DeepSeek V4.1 Flash 1017", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4-pro": { "name": "DeepSeek V4 Pro", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4-pro-0813": { "name": "DeepSeek V4 Pro 0813", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4-flash-0731": { "name": "DeepSeek V4 Flash 0731", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "kimi-k2.7-code": { "name": "Kimi K2.7 Code", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 262144, "output": 98304 } }, "kimi-k2.6": { "name": "Kimi K2.6", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 262144, "output": 98304 } }, "kimi-k2.5": { "name": "Kimi K2.5", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 262144, "output": 98304 } }, "glm-5.3": { "name": "GLM-5.3", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 202752, "output": 16384 } }, "glm-5.2": { "name": "GLM-5.2", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 202752, "output": 16384 } }, "glm-5.1": { "name": "GLM-5.1", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 202752, "output": 16384 } }, "glm-5": { "name": "GLM-5", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 202752, "output": 16384 } }, "MiniMax-M2.5": { "name": "MiniMax M2.5", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 196608, "output": 32768 } } } } } }Substitua{WorkspaceId}pelo ID do Workspace da sua conta.Copy{ "$schema": "https://opencode.ai/config.json", "provider": { "bailian-payg": { "npm": "@ai-sdk/anthropic", "name": "Alibaba Cloud Model Studio", "options": { "baseURL": "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1", "apiKey": "YOUR_API_KEY" }, "models": { "qwen3.8-max": { "name": "Qwen3.8 Max", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "qwen3.7-plus": { "name": "Qwen3.7 Plus", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "qwen3.8-flash": { "name": "Qwen3.8 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 131072 } }, "deepseek-v4-pro-0813": { "name": "DeepSeek V4 Pro 0813", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } } } } } }Copy{ "$schema": "https://opencode.ai/config.json", "provider": { "bailian-coding-plan": { "npm": "@ai-sdk/anthropic", "name": "Alibaba Cloud Model Studio", "options": { "baseURL": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1", "apiKey": "YOUR_API_KEY" }, "models": { "qwen3.7-plus": { "name": "Qwen3.7 Plus", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "qwen3.6-plus": { "name": "Qwen3.6 Plus", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } }, "kimi-k2.5": { "name": "Kimi K2.5", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 262144, "output": 98304 } }, "glm-5": { "name": "GLM-5", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 202752, "output": 16384 } }, "MiniMax-M2.5": { "name": "MiniMax M2.5", "modalities": { "input": [ "text" ], "output": [ "text" ] }, "limit": { "context": 196608, "output": 32768 } }, "qwen3.5-plus": { "name": "Qwen3.5 Plus", "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "limit": { "context": 1000000, "output": 65536 } } } } } }Ao usar qwen4-max-preview, o limite de saída por solicitação é 32000 por padrão. Para gerar uma saída mais longa, definaOPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX.Ao usar qwen4-max, o limite de saída por solicitação é 32000 por padrão. Para permitir saídas mais longas, definaOPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX. qwen4-max tem contexto de 1 M de tokens. A saída máxima é de 131.072 tokens no modo sem pensamento e de 262.144 tokens para pensamento e resposta final combinados. Os padrões são reasoning_effort=high e thinking_budget=131072.
Códigos de erro
Se você encontrar erros durante a configuração, consulte a documentação de perguntas frequentes do seu plano de cobrança:- Token Plan: FAQ da Edição Pessoal · FAQ da Edição de Equipe
- Pagamento conforme o uso: Códigos de erro
- Coding Plan: FAQ do Coding Plan
Perguntas frequentes
Como usar um plano de economia com pagamento conforme o uso?
Como usar um plano de economia com pagamento conforme o uso?
A configuração de pagamento conforme o uso permanece a mesma: use a chave de API geral do Model Studio e a Base URL. Após comprar um plano de economia, ele entra em vigor automaticamente e o uso elegível é deduzido automaticamente. Consulte Planos de economia.
O modelo de que preciso não está na lista
O modelo de que preciso não está na lista
Atualize o OpenCode para a versão mais recente e verifique
/models novamente. Se o modelo ainda não aparecer, defina um provedor personalizado em opencode.json e adicione o modelo. As requisições retornam 401 Unauthorized
As requisições retornam 401 Unauthorized
A chave de API não corresponde ao provedor selecionado, ou a chave pertence a outro plano de cobrança. Execute
/connect novamente, selecione o provedor do seu plano e insira a chave correta.