Use a ChatGPT subscription
Authorize Midscene through Sign in with ChatGPT (SIWC) to call GPT models using your ChatGPT subscription. This guide walks you through sign-in, configuration, and connection verification.
Choose either a ChatGPT subscription or a model API key to connect Midscene. You only need to complete one of these setup guides.
Sign in
Run in your terminal:
Follow the terminal instructions to sign in to ChatGPT in your browser and authorize plan usage. You can choose a name for your Agent during authorization. Once authorized, the Agent appears on your ChatGPT usage page.
The command prints an access token and its expiration time. Copy the token to use as MIDSCENE_MODEL_API_KEY in the next step.
Configure the model
The following example uses gpt-6-sol. Replace <your-access-token> with the token you just obtained:
SIWC requires the Responses API with streaming enabled. Keep the openai-responses and stream settings in the example. Midscene sets store: false by default, as required by this flow. See the official OpenAI documentation.
Available models depend on your ChatGPT account. For other GPT model names, families, and usage notes, see Use a model API key.
Load the configuration
Load the complete configuration above according to how you use Midscene:
- Playground: Paste the configuration text into the settings page.
- CLI: Create a
.envfile in the directory where you run commands and paste the configuration without addingexport. The CLI reads this file automatically. - JavaScript SDK: Load the configuration into the Node.js process environment. For
.envfiles, follow Load configuration with dotenv.
The credentials saved by the sign-in command do not automatically populate these model settings. You still need to set MIDSCENE_MODEL_API_KEY manually.
Verify the connection
Run this command in the directory containing your .env file:
This command uses values from .env to override variables with the same names in the current shell. If your configuration is only saved in Playground, save the same configuration to .env before running the command.
Once verification succeeds, continue with the tasks in Quick start. For failed checks, see Model debugging and observability.
Refresh the access token
Access tokens are valid for one hour. See the OpenAI token reference. Check the expiration time printed by the sign-in command and refresh the token with:
The command updates the local credentials and prints a new access token. Replace MIDSCENE_MODEL_API_KEY in Playground, .env, or your environment variables, then reload the configuration before running another task.
Usage and credentials
- SIWC consumes your subscription usage. ChatGPT determines how token consumption translates into plan usage. Midscene reports show token consumption for each task step.
- Full credentials are saved locally to
~/.midscene/siwc.jsonfor subsequent refreshes. Midscene does not collect your credentials. - Follow OpenAI's regional restrictions and terms of use. See the Sign in with ChatGPT Terms.
Reuse your Codex sign-in (deprecated)
If you already signed in with Codex Cli (codex login) and want Midscene to use that OAuth session directly, set:
Notes:
MIDSCENE_MODEL_API_KEYis not required in this mode.- Midscene will call
codex app-serverthrough stdio. - Make sure
codexis available in your PATH and verify auth withcodex login status.
The drawback of this approach is that we have observed longer execution times and higher token consumption than when calling an OpenAI-compatible API directly. For this reason, we do not recommend it.

