Are you an LLM? View /llms.txt for optimized Markdown documentation, or /llms-full.txt for full documentation bundle. This page is also available as Markdown at /model-common-config.md
Connect Midscene using an API key from a model provider. This guide covers model configuration and connection verification. If you already have a ChatGPT subscription, you can also follow Use a ChatGPT subscription.
The model configuration shown on this page consists of environment variables. Provide it according to how you use Midscene:
In Playground, paste the configuration text from this page directly into the settings page.
For an overview of supported models and connection methods, see the Model Selection Guide. Configuration examples for each model follow.
Each configuration requires a Base URL, API key, model name, and MIDSCENE_MODEL_FAMILY. The model family (MIDSCENE_MODEL_FAMILY) determines how Midscene adapts to the selected model.
2.x series doubao-seed-2-1-pro-260915doubao-seed-2-1-turbo-260628
doubao-seed
doubao-seed-2-1-turbo-260628 offers fast localization and strong localization quality. Recommended.
1.x series Doubao-Seed-1.6-VisionDoubao-Seed-1.8
doubao-seed
The 1.x series is an older generation of Doubao models and is no longer competitive overall. We recommend using the 2.x series instead. For compatibility with existing configurations, MIDSCENE_MODEL_FAMILY="doubao-vision" remains supported. New configurations should use doubao-seed.
Environment variable configuration example, using doubao-seed-2-1-turbo-260628:
If your Volcano Engine account has Fast Tier quota enabled, add the extra request body below to use it. This usually improves model response speed by about 30%-50%.
Qwen3.x series qwen3.7-plusqwen3.5-plusqwen3.6-plus
qwen3
Based on localization evaluation results, the recommended order is Qwen3.7 > Qwen3.5 > Qwen3.6. The previous qwen3.5 and qwen3.6 families remain compatible.
Qwen3-VL series qwen3-vl-plus
qwen3-vl
As an older model generation, it is not recommended. Use the Qwen3.x series instead.
Qwen2.5-VL series qwen-vl-max-latest
qwen2.5-vl
As an older model generation, it is not recommended. Use the Qwen3.x series instead.
Environment variable configuration example, using qwen3.7-plus:
🤖 Use as default model
🎯 Use as Locate model
🧠 Use as Planning model
🔎 Use as Insight model
MIDSCENE_MODEL_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" # Alibaba Cloud endpoint
MIDSCENE_MODEL_API_KEY="......"
MIDSCENE_MODEL_NAME="qwen3.7-plus"
MIDSCENE_MODEL_FAMILY="qwen3" # If you use another Qwen version, replace this with the corresponding model family
MIDSCENE_LOCATE_MODEL_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" # Alibaba Cloud endpoint
MIDSCENE_LOCATE_MODEL_API_KEY="......"
MIDSCENE_LOCATE_MODEL_NAME="qwen3.7-plus"
MIDSCENE_LOCATE_MODEL_FAMILY="qwen3" # If you use another Qwen version, replace this with the corresponding model family
MIDSCENE_PLANNING_MODEL_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" # Alibaba Cloud endpoint
MIDSCENE_PLANNING_MODEL_API_KEY="......"
MIDSCENE_PLANNING_MODEL_NAME="qwen3.7-plus"
MIDSCENE_PLANNING_MODEL_FAMILY="qwen3" # If you use another Qwen version, replace this with the corresponding model family
MIDSCENE_INSIGHT_MODEL_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1" # Alibaba Cloud endpoint
MIDSCENE_INSIGHT_MODEL_API_KEY="......"
MIDSCENE_INSIGHT_MODEL_NAME="qwen3.7-plus"
MIDSCENE_INSIGHT_MODEL_FAMILY="qwen3" # If you use another Qwen version, replace this with the corresponding model family
Gemini 3.x series gemini-3.5-flashgemini-3-flash-preview
gemini
gemini-3.5-flash currently performs best for localization in our private evaluation set.
Environment variable configuration example, using gemini-3.5-flash:
🤖 Use as default model
🎯 Use as Locate model
🧠 Use as Planning model
🔎 Use as Insight model
MIDSCENE_MODEL_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai/" # Google Gemini API endpoint
MIDSCENE_MODEL_API_KEY="......"
MIDSCENE_MODEL_NAME="gemini-3.5-flash"
MIDSCENE_MODEL_FAMILY="gemini"
MIDSCENE_LOCATE_MODEL_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai/" # Google Gemini API endpoint
MIDSCENE_LOCATE_MODEL_API_KEY="......"
MIDSCENE_LOCATE_MODEL_NAME="gemini-3.5-flash"
MIDSCENE_LOCATE_MODEL_FAMILY="gemini"
MIDSCENE_PLANNING_MODEL_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai/" # Google Gemini API endpoint
MIDSCENE_PLANNING_MODEL_API_KEY="......"
MIDSCENE_PLANNING_MODEL_NAME="gemini-3.5-flash"
MIDSCENE_PLANNING_MODEL_FAMILY="gemini"
MIDSCENE_INSIGHT_MODEL_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai/" # Google Gemini API endpoint
MIDSCENE_INSIGHT_MODEL_API_KEY="......"
MIDSCENE_INSIGHT_MODEL_NAME="gemini-3.5-flash"
MIDSCENE_INSIGHT_MODEL_FAMILY="gemini"
GPT-6 Sol delivers excellent visual localization accuracy at just one-fifth the price of GPT-6 Astra. GPT-6 Luna is very inexpensive while also offering good visual localization capabilities.
GPT-5 series gpt-5.4gpt-5.5gpt-5.6-solgpt-5.6-terragpt-5.6-luna
gpt-5
Models before GPT-5.4 do not support visual localization and can only be used as Planning or Insight models. In practical localization tests, GPT-5.5 and GPT-5.6 perform noticeably better than GPT-5.4; we recommend using GPT-5.5 or GPT-5.6 first.
Use an API Key
Environment variable configuration example, using gpt-6-sol:
🤖 Use as default model
🎯 Use as Locate model
🧠 Use as Planning model
🔎 Use as Insight model
MIDSCENE_MODEL_BASE_URL="https://api.openai.com/v1" # OpenAI API endpoint; or your compatible endpoint
MIDSCENE_MODEL_API_KEY="......"
MIDSCENE_MODEL_NAME="gpt-6-sol"
MIDSCENE_MODEL_FAMILY="gpt-6"
MIDSCENE_LOCATE_MODEL_BASE_URL="https://api.openai.com/v1" # OpenAI API endpoint; or your compatible endpoint
MIDSCENE_LOCATE_MODEL_API_KEY="......"
MIDSCENE_LOCATE_MODEL_NAME="gpt-6-sol"
MIDSCENE_LOCATE_MODEL_FAMILY="gpt-6"
MIDSCENE_PLANNING_MODEL_BASE_URL="https://api.openai.com/v1" # OpenAI API endpoint; or your compatible endpoint
MIDSCENE_PLANNING_MODEL_API_KEY="......"
MIDSCENE_PLANNING_MODEL_NAME="gpt-6-sol"
MIDSCENE_PLANNING_MODEL_FAMILY="gpt-6"
MIDSCENE_INSIGHT_MODEL_BASE_URL="https://api.openai.com/v1" # OpenAI API endpoint; or your compatible endpoint
MIDSCENE_INSIGHT_MODEL_API_KEY="......"
MIDSCENE_INSIGHT_MODEL_NAME="gpt-6-sol"
MIDSCENE_INSIGHT_MODEL_FAMILY="gpt-6"
Enable Fast mode (service_tier="fast")
Both GPT-5.6 Sol and GPT-6 Astra support Fast mode. Add the service_tier request body parameter to enable it. For example, with GPT-5.6 Sol:
According to OpenAI, Fast mode can deliver up to 2–2.5× the speed at twice the Standard rate. Refer to the official documentation for current speed, pricing, and usage restrictions.
GPT-5.4 or later is required for UI localization. Midscene does not support earlier versions.
According to OpenAI, GPT-5 may still struggle with non-Latin text and with text that is too small in the image. See the Images and Vision guide.
In the computer use guide, OpenAI says they observe good performance around 1440x900 and 1600x900. We recommend adjusting screenshot sizes accordingly. In Midscene, you can control screenshot compression with screenshotShrinkFactor in the agent options. For browser automation, you can also control the page size and scale through the browser viewport.
Azure OpenAI's Chat Completions API may not handle "detail": "original" correctly, causing click-coordinate offsets. If you encounter this issue, you can switch to the Responses API. See Clicks are offset when using Azure OpenAI.
According to the Kimi documentation, K3 always has reasoning enabled and cannot be disabled. Its reasoning effort defaults to max.
K2.x series kimi-k2.5kimi-k2.6
kimi
—
Environment variable configuration example, using kimi-k3:
🤖 Use as default model
🎯 Use as Locate model
🧠 Use as Planning model
🔎 Use as Insight model
MIDSCENE_MODEL_BASE_URL="https://api.moonshot.cn/v1" # Moonshot AI API endpoint
MIDSCENE_MODEL_API_KEY="......"
MIDSCENE_MODEL_NAME="kimi-k3"
MIDSCENE_MODEL_FAMILY="kimi3" # For kimi-k2.6, use "kimi"
MIDSCENE_LOCATE_MODEL_BASE_URL="https://api.moonshot.cn/v1" # Moonshot AI API endpoint
MIDSCENE_LOCATE_MODEL_API_KEY="......"
MIDSCENE_LOCATE_MODEL_NAME="kimi-k3"
MIDSCENE_LOCATE_MODEL_FAMILY="kimi3" # For kimi-k2.6, use "kimi"
MIDSCENE_PLANNING_MODEL_BASE_URL="https://api.moonshot.cn/v1" # Moonshot AI API endpoint
MIDSCENE_PLANNING_MODEL_API_KEY="......"
MIDSCENE_PLANNING_MODEL_NAME="kimi-k3"
MIDSCENE_PLANNING_MODEL_FAMILY="kimi3" # For kimi-k2.6, use "kimi"
MIDSCENE_INSIGHT_MODEL_BASE_URL="https://api.moonshot.cn/v1" # Moonshot AI API endpoint
MIDSCENE_INSIGHT_MODEL_API_KEY="......"
MIDSCENE_INSIGHT_MODEL_NAME="kimi-k3"
MIDSCENE_INSIGHT_MODEL_FAMILY="kimi3" # For kimi-k2.6, use "kimi"
V2.x series mimo-v2.6-promimo-v2.6-flashmimo-v2.6-pro-ultraspeedmimo-v2.5
xiaomi-mimo
All 2.6 models support multimodal input; for 2.5, only the Omni series supports multimodal input.
Environment variable configuration example, using mimo-v2.6-pro:
🤖 Use as default model
🎯 Use as Locate model
🧠 Use as Planning model
🔎 Use as Insight model
MIDSCENE_MODEL_BASE_URL="https://api.xiaomimimo.com/v1" # Xiaomi MiMo API endpoint
MIDSCENE_MODEL_API_KEY="......"
MIDSCENE_MODEL_NAME="mimo-v2.6-pro"
MIDSCENE_MODEL_FAMILY="xiaomi-mimo"
MIDSCENE_LOCATE_MODEL_BASE_URL="https://api.xiaomimimo.com/v1" # Xiaomi MiMo API endpoint
MIDSCENE_LOCATE_MODEL_API_KEY="......"
MIDSCENE_LOCATE_MODEL_NAME="mimo-v2.6-pro"
MIDSCENE_LOCATE_MODEL_FAMILY="xiaomi-mimo"
MIDSCENE_PLANNING_MODEL_BASE_URL="https://api.xiaomimimo.com/v1" # Xiaomi MiMo API endpoint
MIDSCENE_PLANNING_MODEL_API_KEY="......"
MIDSCENE_PLANNING_MODEL_NAME="mimo-v2.6-pro"
MIDSCENE_PLANNING_MODEL_FAMILY="xiaomi-mimo"
MIDSCENE_INSIGHT_MODEL_BASE_URL="https://api.xiaomimimo.com/v1" # Xiaomi MiMo API endpoint
MIDSCENE_INSIGHT_MODEL_API_KEY="......"
MIDSCENE_INSIGHT_MODEL_NAME="mimo-v2.6-pro"
MIDSCENE_INSIGHT_MODEL_FAMILY="xiaomi-mimo"
Environment variable configuration example, using glm-5v-turbo:
🤖 Use as default model
🎯 Use as Locate model
🧠 Use as Planning model
🔎 Use as Insight model
MIDSCENE_MODEL_BASE_URL="https://open.bigmodel.cn/api/paas/v4" # BigModel API endpoint; use https://api.z.ai/api/paas/v4 for Z.AI
MIDSCENE_MODEL_API_KEY="......"
MIDSCENE_MODEL_NAME="glm-5v-turbo"
MIDSCENE_MODEL_FAMILY="glm-v"
MIDSCENE_LOCATE_MODEL_BASE_URL="https://open.bigmodel.cn/api/paas/v4" # BigModel API endpoint; use https://api.z.ai/api/paas/v4 for Z.AI
MIDSCENE_LOCATE_MODEL_API_KEY="......"
MIDSCENE_LOCATE_MODEL_NAME="glm-5v-turbo"
MIDSCENE_LOCATE_MODEL_FAMILY="glm-v"
MIDSCENE_PLANNING_MODEL_BASE_URL="https://open.bigmodel.cn/api/paas/v4" # BigModel API endpoint; use https://api.z.ai/api/paas/v4 for Z.AI
MIDSCENE_PLANNING_MODEL_API_KEY="......"
MIDSCENE_PLANNING_MODEL_NAME="glm-5v-turbo"
MIDSCENE_PLANNING_MODEL_FAMILY="glm-v"
MIDSCENE_INSIGHT_MODEL_BASE_URL="https://open.bigmodel.cn/api/paas/v4" # BigModel API endpoint; use https://api.z.ai/api/paas/v4 for Z.AI
MIDSCENE_INSIGHT_MODEL_API_KEY="......"
MIDSCENE_INSIGHT_MODEL_NAME="glm-5v-turbo"
MIDSCENE_INSIGHT_MODEL_FAMILY="glm-v"
Jev is a model for making choices. You can use it to select the next action, locate UI elements, and evaluate whether a condition holds. It is fast and inexpensive, but is not suitable for tasks that require complex reasoning.
First configure a general-purpose default model (MIDSCENE_MODEL_*) and keep that configuration, then add the Jev configuration below. Jev handles Planning, Locate, and Insight; the general-purpose default model still handles tasks Jev cannot perform. See Multiple models for default model configuration.
Copy the following configuration to use Jev for Planning, Locate, and Insight:
# Planning
MIDSCENE_PLANNING_MODEL_BASE_URL="https://api.typesafe.ai/v1" # TypeSafe official API endpoint
MIDSCENE_PLANNING_MODEL_API_KEY="......"
MIDSCENE_PLANNING_MODEL_NAME="jev-1.14.0"
MIDSCENE_PLANNING_MODEL_FAMILY="jev"
# Locate
MIDSCENE_LOCATE_MODEL_BASE_URL="https://api.typesafe.ai/v1" # TypeSafe official API endpoint
MIDSCENE_LOCATE_MODEL_API_KEY="......"
MIDSCENE_LOCATE_MODEL_NAME="jev-1.14.0"
MIDSCENE_LOCATE_MODEL_FAMILY="jev"
# Insight
MIDSCENE_INSIGHT_MODEL_BASE_URL="https://api.typesafe.ai/v1" # TypeSafe official API endpoint
MIDSCENE_INSIGHT_MODEL_API_KEY="......"
MIDSCENE_INSIGHT_MODEL_NAME="jev-1.14.0"
MIDSCENE_INSIGHT_MODEL_FAMILY="jev"
Jev uses TypeSafe's System One protocol, not an OpenAI protocol. Some OpenAI model settings do not apply, such as temperature, native reasoning, response format, and streaming output.
Image input limits
Jev requires the longest edge of an input image to be no more than 1568 pixels. Midscene therefore scales images that exceed this limit while preserving their aspect ratio, then maps localization results back to the original image coordinates. Edges shorter than 280 pixels are padded. This image processing behavior may change in future versions.
Midscene reads model configuration from environment variables. Choose the method that matches how you use Midscene, or keep using your project's existing environment-management approach.
The following example works in Bash and Zsh. These variables are available only to the current shell session and its child processes.
# Replace every value with the configuration for your selected model providerexport MIDSCENE_MODEL_BASE_URL="https://replace-with-your-model-service-url/v1"export MIDSCENE_MODEL_API_KEY="replace-with-your-api-key"export MIDSCENE_MODEL_NAME="replace-with-your-model-name"export MIDSCENE_MODEL_FAMILY="replace-with-the-family-for-your-model"
Create a .env file in the directory where you run the midscene command. @midscene/cli loads this file automatically.
# Replace every value with the configuration for your selected model providerMIDSCENE_MODEL_BASE_URL="https://replace-with-your-model-service-url/v1"MIDSCENE_MODEL_API_KEY="replace-with-your-api-key"MIDSCENE_MODEL_NAME="replace-with-your-model-name"MIDSCENE_MODEL_FAMILY="replace-with-the-family-for-your-model"
Do not add export at the beginning of each line. When running YAML tasks, existing variables in the current shell take precedence over values with the same name in .env. To let .env override them, use --dotenv-override.
midscene model verify is an exception. This command uses values from .env to override variables with the same name in the current shell.
The Midscene JavaScript SDK reads model configuration directly from the Node.js process environment (process.env). If the shell, container, or deployment platform already provides these variables, you do not need dotenv. Use dotenv only when the configuration is stored in a .env file and needs to be loaded into process.env.
npm
yarn
pnpm
bun
deno
npm install dotenv
yarn add dotenv
pnpm add dotenv
bun add dotenv
deno add npm:dotenv
Create a .env file in the directory where you run the script:
# Replace every value with the configuration for your selected model providerMIDSCENE_MODEL_BASE_URL="https://replace-with-your-model-service-url/v1"MIDSCENE_MODEL_API_KEY="replace-with-your-api-key"MIDSCENE_MODEL_NAME="replace-with-your-model-name"MIDSCENE_MODEL_FAMILY="replace-with-the-family-for-your-model"
Import dotenv before creating a Midscene Agent:
import 'dotenv/config';
If a variable with the same name already exists in the current shell, dotenv keeps the existing value by default. The Midscene demo project uses this loading method as well.
For model roles and combination guidance, see the Model Selection Guide. The example below shows configuration for the Default, Planning, Locate, and Insight models.
Keep the required Default model configuration and add specialized models as needed. Roles without a dedicated model use the Default model. Set each specialized model's endpoint, API key, model name, and family independently. Replace the placeholders and model names with the actual configuration from your providers.
The following smaller models are also compatible with Midscene and designed for automation. They require less deployment hardware but may struggle with complex tasks or large screenshots. Evaluate them against your tasks and deployment constraints before choosing one.
MIDSCENE_MODEL_BASE_URL="https://api.z.ai/api/paas/v4" # Or https://open.bigmodel.cn/api/paas/v4MIDSCENE_MODEL_API_KEY="......"MIDSCENE_MODEL_NAME="autoglm-phone"MIDSCENE_MODEL_FAMILY="auto-glm" # Or "auto-glm-multilingual"
About MIDSCENE_MODEL_FAMILY Configuration
AutoGLM provides two model versions, distinguished by MIDSCENE_MODEL_FAMILY:
auto-glm - Corresponds to AutoGLM-Phone-9B, optimized for Chinese mobile applications
auto-glm-multilingual - Corresponds to AutoGLM-Phone-9B-Multilingual, supports English and other languages
Choose the appropriate version based on your application language.
Info
AutoGLM is best suited for mobile interaction. APIs such as aiAssert and aiQuery require page understanding. When using these APIs, configure a separate Insight model with the MIDSCENE_INSIGHT_MODEL_... environment variables. See Model Selection Guide for details.
MIDSCENE_MODEL_BASE_URL="https://ark.cn-beijing.volces.com/api/v3"MIDSCENE_MODEL_API_KEY="...."MIDSCENE_MODEL_NAME="ep-2025..." # Inference endpoint ID or model name from Volcano EngineMIDSCENE_MODEL_FAMILY="vlm-ui-tars-doubao-1.5"
About MIDSCENE_MODEL_FAMILY
This variable selects the UI-TARS version. Supported values:
vlm-ui-tars – for the 1.0 release
vlm-ui-tars-doubao – for the 1.5 release deployed on Volcano Engine (equivalent to vlm-ui-tars-doubao-1.5)
vlm-ui-tars-doubao-1.5 – for the 1.5 release deployed on Volcano Engine
Info
The legacy configurations MIDSCENE_USE_VLM_UI_TARS=DOUBAO or MIDSCENE_USE_VLM_UI_TARS=1.5 are still supported but deprecated. Please migrate to MIDSCENE_MODEL_FAMILY.