## TL;DR

Alternatively pinning leptonai==0.21.3 keeps the old path working as a quick fix. The old API module was moved, not removed.

## Steps

1. The old API module was moved, not removed. Update your import to from leptonai.api.v0.workspace import WorkspaceInfoLocalRecord and it will work. If you want the new style API instead, use from leptonai.api.v1.client import APIClient, then c.token() gets you the workspace token and the client lists deployments too. Alternatively pinning leptonai==0.21.3 keeps the old path working as a quick fix. Source: https://github.com/leptonai/leptonai/issues/481

## When to use

You are seeing this: After upgrading leptonai, from leptonai.api.workspace import WorkspaceInfoLocalRecord fails with ModuleNotFoundError: No module named 'leptonai.api.workspace'. Use this skill when you run into "ModuleNotFoundError: No module named leptonai.api.workspace after upgrade".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: leptonai 0.21.3. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/leptonai/leptonai/issues/481
