The official Python client for the Codesphere API.
uv add codesphereCreate a .env file in your project root:
| Variable | Description | Default |
|---|---|---|
CS_TOKEN |
API token (required) | – |
CS_BASE_URL |
API base URL | https://codesphere.com/api |
import asyncio
from codesphere import CodesphereSDK
async def main():
async with CodesphereSDK() as sdk:
teams = await sdk.teams.list()
for team in teams:
print(f"{team.name} (ID: {team.id})")
asyncio.run(main())teams = await sdk.teams.list()
team = await sdk.teams.get(team_id=123)
await team.delete()workspaces = await sdk.workspaces.list(team_id=123)
workspace = await sdk.workspaces.get(workspace_id=456)
result = await workspace.execute_command("ls -la")
print(result.output)
await workspace.env_vars.set([{"name": "API_KEY", "value": "secret"}])
env_vars = await workspace.env_vars.get()team = await sdk.teams.get(team_id=123)
domains = await team.domains.list()
domain = await team.domains.create(name="api.example.com")datacenters = await sdk.metadata.list_datacenters()
plans = await sdk.metadata.list_plans()
images = await sdk.metadata.list_images()git clone https://github.com/Datata1/codesphere-python.git
cd codesphere-python
uv sync --all-extras
uv run pytestMIT – see LICENSE for details.