Use a model API key
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.
- With the SDK or CLI, load the configuration as described in Set environment variables.
For advanced parameter definitions, see Model advanced configuration and debugging.
Supported models
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) selects the model adapter, which determines coordinate handling, supported API protocols, and how reasoning and output parameters are sent. Use the family listed for your model below.
Doubao Seed Series
View model configuration
- Common model provider: Volcano Engine
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%.
Qwen Series
View model configuration
- Common model provider: Alibaba Cloud
Environment variable configuration example, using qwen3.7-plus:
DeepSeek Series
View model configuration
Midscene supports DeepSeek starting from v1.12.0.
- Common model provider: DeepSeek - Vision
Environment variable configuration example, using deepseek-flash:
Google Gemini Series
View model configuration
- Common model provider: Google Gemini
Environment variable configuration example, using gemini-3.5-flash:
OpenAI GPT Series
View model configuration
To connect using your ChatGPT subscription, see Use a ChatGPT subscription.
- Common model provider: OpenAI
Use an API Key
Environment variable configuration example, using gpt-6-sol:
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.
To reuse a Codex CLI session, see Use Codex App Server.
When using GPT, note the following:
- 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
1440x900and1600x900. We recommend adjusting screenshot sizes accordingly. In Midscene, you can control screenshot compression withscreenshotShrinkFactorin the agent options. For browser automation, you can also control the page size and scale through the browserviewport. - 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.
Moonshot Kimi Series
View model configuration
- Common model provider: Moonshot AI platform
Environment variable configuration example, using kimi-k3:
Xiaomi MiMo Series
View model configuration
- Common model provider: Xiaomi MiMo API Open Platform
Environment variable configuration example, using mimo-v2.6-pro:
Zhipu GLM-V Series
View model configuration
- Common model providers: Z.AI (Global), BigModel (CN)
Environment variable configuration example, using glm-5v-turbo:
Learn more about the open-source GLM-4.6V model
- Github: https://github.com/zai-org/GLM-V
- Hugging Face: https://huggingface.co/zai-org/GLM-4.6V
Jev (experimental)
View model configuration
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.
Midscene support for Jev is experimental.
- Model provider: TypeSafe
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:
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.
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.
Set environment variables
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.
Set environment variables in the current shell
The following example works in Bash and Zsh. These variables are available only to the current shell session and its child processes.
Configure through a .env file
Midscene Test (@midscene/test) and the legacy YAML script runner (@midscene/cli) automatically load configuration from .env.
For Midscene Test, copy .env.example to .env in the generated test project directory, fill in the model configuration, then run pnpm test. See Create and use test projects for details. For the legacy YAML script runner, create .env in the directory where you run midscene.
Example .env contents:
Do not add export at the beginning of each line. With the legacy YAML script runner, existing shell variables take precedence over matching values in .env; use --dotenv-override to prefer values from the file.
The Midscene SDK reads model configuration from process.env. When writing test scripts, you can install dotenv in your own test project, store model configuration in a .env file at the project root, and add import 'dotenv/config' to your script entry point. Run the script from the project root and load the configuration before creating an Agent.
Other compatible models
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.
Zhipu AutoGLM Series
View model configuration
Zhipu AutoGLM is an open-source mobile UI automation model (9B parameters) from Zhipu AI.
After obtaining an API key from Z.AI (Global) or BigModel (CN), configure:
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 applicationsauto-glm-multilingual- Corresponds to AutoGLM-Phone-9B-Multilingual, supports English and other languages
Choose the appropriate version based on your application language.
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.
Learn more about Zhipu AutoGLM
- Github: https://github.com/zai-org/Open-AutoGLM
- Hugging Face: https://huggingface.co/zai-org/AutoGLM-Phone-9B
UI-TARS Series
View model configuration
Use the deployed doubao-1.5-ui-tars on Volcano Engine:
About MIDSCENE_MODEL_FAMILY
This variable selects the UI-TARS version. Supported values:
vlm-ui-tars– for the 1.0 releasevlm-ui-tars-doubao– for the 1.5 release deployed on Volcano Engine (equivalent tovlm-ui-tars-doubao-1.5)vlm-ui-tars-doubao-1.5– for the 1.5 release deployed on Volcano Engine
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.
Migration mapping:
MIDSCENE_USE_VLM_UI_TARS=1.0→MIDSCENE_MODEL_FAMILY="vlm-ui-tars"MIDSCENE_USE_VLM_UI_TARS=1.5→MIDSCENE_MODEL_FAMILY="vlm-ui-tars-doubao-1.5"MIDSCENE_USE_VLM_UI_TARS=DOUBAO→MIDSCENE_MODEL_FAMILY="vlm-ui-tars-doubao"
Next steps
- Verify model connectivity — Check that your configured models work with Midscene.
- Configure models by intent — Use dedicated models for planning, localization, or page understanding, with an expandable configuration example.
- Common configuration errors — Resolve model family, endpoint, or model name errors.
- When model results are unreliable — Investigate incorrect actions, missed targets, or misinterpreted pages.

