VS Code
Use Alibaba Cloud Model Studio models in VS Code.
Quick Start
- 1
Get an API key
Get the API key for your billing plan:
- Token Plan Personal Edition: Create or view API Key
- Token Plan Team Edition: Assign a seat and get the API Key
- Pay-as-you-go: Model Studio API key
- Coding Plan: Coding Plan API key
- 2
Open model management
In VS Code, run
Chat: Manage Language Models, select Add Models > Custom Endpoint, and select Chat Completions as the protocol. - 3
Enter the connection details
Follow the wizard to enter a group name, display name, and the API key for your plan. The wizard generates a secure input reference for
apiKey; do not put the actual key in plaintext JSON. - 4
Select a model
Enter the connection URL and model for your billing plan:
Token Plan
- Base URL:
https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 - Full
url:https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions - Models: Enter a text generation model supported by Personal Edition or Team Edition
Pay-as-you-go
Replace
{WorkspaceId}with your actual Workspace ID.- Base URL:
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 - Full
url:https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions - Models: for example,
qwen3.8-maxorqwen3.8-flash
Coding Plan
- Base URL:
https://coding.dashscope.aliyuncs.com/v1 - Full
url:https://coding.dashscope.aliyuncs.com/v1/chat/completions - Models: for example,
qwen3.7-plus
- Base URL:
- 5
Configure model parameters
In
chatLanguageModels.json, configure the following fields:vendor:customendpointapiType:chat-completionsmodels[].id: The model ID from the previous stepmodels[].name: A display name of your choicemodels[].url: The fullurlfrom the previous stepmodels[].toolCalling,vision,maxInputTokens,maxOutputTokens: Set these according to the model's specifications
Confirm that your plan supports the model, then check the model list. The sum of input and output tokens must not exceed the model's context length. For field descriptions, see the VS Code official documentation.
- 6
Verify
Select the configured model in the Chat model picker and send "Hello". A reply confirms the connection.
FAQ
How do I use savings plans and resource plans with pay-as-you-go?
The pay-as-you-go setup remains the same: use your general Model Studio API key and Base URL. After you purchase a savings plan or resource plan, it takes effect automatically and eligible usage is deducted automatically. See Savings plans and resource plans.
The model does not appear in the VS Code Chat model picker
Save chatLanguageModels.json, restart VS Code, and check the model picker again.
The model cannot be called or returns 401
Confirm that the API key, Base URL, and model belong to the same plan. API keys for Token Plan, Coding Plan, and pay-as-you-go are not interchangeable. For pay-as-you-go, also confirm that {WorkspaceId} has been replaced with the Workspace ID for the correct region.
An organization policy restricts BYOK
Ask your Copilot Business / Enterprise administrator to check the Bring Your Own Language Model Key in VS Code policy.