jcode credential migration and multi-model configuration: reusing Codex, Claude, and Gemini login sessions

jcode credential migration and multi-model configuration: reuse Codex, Claude, and Gemini login sessions, covering configuration, verification, permission boundaries, failback, and long-term maintenance.

This tutorial by jcode only deals with the specific task in the title. jcode can discover a variety of existing CLI credentials, but credential reuse does not mean copying files; you should first determine whether the Provider can work non-interactively, and then decide on the login path.

All the following operations are first placed in the test repository, test account or service that listens only on the loopback interface. The domain name, username, path and key in the command are placeholders and need to be replaced before execution.

First take inventory of the existing model sessions on this machine

This section solves the problem of “first taking stock of the existing model sessions on this machine”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For jcode, the basis for judgment is: jcode can discover a variety of existing CLI credentials, but credential reuse does not mean copying files; you should first determine whether the Provider can work non-interactively, and then decide the login path. Don’t accidentally open more permissions at this stage.

1
Get-Command codex, claude, gemini, jcode -ErrorAction SilentlyContinue

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

Confirm PATH after Windows installation

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
2
irm https://jcode.sh/install.ps1 | iex
Get-Command jcode

The completion criterion here is not that the interface appears, but that “Confirm PATH after Windows installation” has repeatable results.

Where is jcode’s own certification directory located?

What to check Acceptable performance Signals that you need to stop
Where to place jcode’s own certification directory Clear input and output scope Automatically expand to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
Get-ChildItem -Force $env:USERPROFILE\.jcode -ErrorAction SilentlyContinue

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

Do a read-only check before reusing the Codex login session

Prepare a success sample and a failure sample around “doing a read-only check before reusing the Codex login session”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
codex --version

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

Search order for Claude credentials

This section addresses “Search order for Claude credentials”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For jcode, the basis for judgment is: jcode can discover a variety of existing CLI credentials, but credential reuse does not mean copying files; you should first determine whether the Provider can work non-interactively, and then decide the login path. Don’t accidentally open more permissions at this stage.

1
Get-ChildItem -Force $env:USERPROFILE\.claude -ErrorAction SilentlyContinue

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

The difference between Gemini OAuth and environment variables

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
Get-ChildItem Env:GEMINI* -ErrorAction SilentlyContinue

The completion criterion here is not that the interface appears, but that “The difference between Gemini OAuth and environment variables” has reproducible results.

Independent configuration of OpenRouter and Azure OpenAI

What to check Acceptable performance Signals that you need to stop
Independent configuration of OpenRouter and Azure OpenAI Clear scope of input and output Automatic expansion to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
Get-ChildItem Env:OPENROUTER_API_KEY,Env:AZURE_OPENAI_ENDPOINT -ErrorAction SilentlyContinue

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

How to select the default model when multiple Providers exist at the same time

Prepare a success sample and a failure sample around “How to choose the default model when multiple Providers exist at the same time”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
jcode

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

New terminal verification instead of inheriting the current environment

This section addresses “new terminal verification rather than continuing the current environment”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For jcode, the basis for judgment is: jcode can discover a variety of existing CLI credentials, but credential reuse does not mean copying files; you should first determine whether the Provider can work non-interactively, and then decide the login path. Don’t accidentally open more permissions at this stage.

1
pwsh -NoLogo -NoProfile

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

Avoid writing refresh tokens to the log

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
git grep -n -I -E 'API_KEY|TOKEN' -- .

The completion criterion here is not that the interface appears, but that “avoid writing refresh tokens to the log” has repeatable results.

Restore the original CLI when migration fails

What to check Acceptable performance Signals that you need to stop
Restore original CLI when migration fails Clear input and output scope Automatically expand to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
2
codex --version
claude --version

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

Security check before using multiple sessions

Prepare a success sample and a failure sample around “Security check before multi-session use”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
jcode

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

Local Embedding and memory usage

This section addresses “Local Embedding and Memory Occupation”. First record the current state, then perform the minimum action, and finally confirm the result with independent evidence.

For jcode, the basis for judgment is: jcode can discover a variety of existing CLI credentials, but credential reuse does not mean copying files; you should first determine whether the Provider can work non-interactively, and then decide the login path. Don’t accidentally open more permissions at this stage.

1
jcode

Preserve command output and timestamp after execution. If the output depends on temporary variables in the current terminal, open a new terminal and check again.

Browser tools are licensed separately

Process in the following order:

  1. Read the actual version and current configuration.
  2. Change only one setting relevant to this section.
  3. Run a read-only or revocable request.
  4. Check logs, exit codes, and final files.
  5. Revert the previous modification if it fails.
1
jcode

The completion standard here is not the appearance of the interface, but the repeatable results of “browser tool separate authorization”.

Swarm multiple sessions to avoid modification conflicts

What to check Acceptable performance Signals that you need to stop
Swarm multi-session avoids modification conflicts Clear input and output scope Automatically expand to other projects or accounts
Permissions Get only the permissions you need to complete the task Require administrator rights or full key
Log Failed to locate and has been desensitized Token, Cookie or private text appears
Rollback Can restore the previous state Modifications are irreversible and there is no backup
1
git worktree list

Once the stop signal in the table appears, undo the changes in this section first and do not continue with subsequent automation.

Keep the original Provider login after uninstalling

Prepare a success sample and a failure sample around “Keep the original Provider login after uninstallation”. Successful samples verify the normal path, and failed samples verify whether the restrictions really take effect.

1
Get-Command codex, claude, gemini -ErrorAction SilentlyContinue

It is recommended to record the following four items:

  • Pre-execution version or Git commit.
  • Actual input, no secret value recorded.
  • Observable output, status code or diff.
  • Recovery actions and review results after recovery.

If the cause of the failure is still unclear, modify only one variable at a time; do not change the port, runtime, provider, and proxy at the same time.

jcode FAQ

Is it possible to skip the test environment and use jcode directly in the official project?

Not recommended. Complete at least one minimal success request, one intentional failure, and one recovery drill first.

The jcode command can be run but the result is incorrect, where should I check first?

First check the input range, actual effective configuration and upstream response, and then check the model summary. A normal process does not mean that the business results are correct.

How to prevent jcode’s keys or tokens from entering Git?

Use system environment variables, secret management, or configuration files outside the project, and search the diff before committing. Keys must be rotated after a breach is discovered.

What is most likely to be missed when upgrading jcode?

It is most easy to miss configuration format, default listening address, permission scope and cache compatibility. Save the version and verification samples before upgrading.

jcode acceptance issues

Upon completion you should be able to answer the following questions:

  • Which exact version are you using?
  • Which directories, ports, accounts and external services can be accessed?
  • How to return the successful result to the original data or Git diff?
  • When the upstream fails, will it report an error, retry, or switch?
  • Is it possible that the key appears in logs or history?
  • How to return to the pre-modification state within ten minutes?

If any of these cannot be answered, jcode is still in trial status and should not expand permissions or tap into production automation.