cosmo
Sign in to Cosmo once. The Cosmo SDKs — Python, TypeScript, Swift — pick up the credential from disk, so an app you run locally needs no key in its source, its environment, or its config.
cosmo login # opens your browser; pick a workspace
cosmo whoami # who you are and where
cosmo logout # revoke the stored key and remove it from this machine
cosmo version
There is no session and nothing running in the background. cosmo login
mints a workspace API key, writes it to ~/.cosmo/credentials, and exits.
Every later read is a file read. The key expires, and you sign in again.
cosmo logout is a revocation, not just a file delete: it retires the key
server-side (against the backend the profile names), then removes the
profile — other profiles, and anything another tool wrote, are preserved.
If the server can't be reached the credentials are left in place, so a live
key is never forgotten locally while it still works.
The credentials file
~/.cosmo/credentials, mode 0600:
version = 1
[default]
slug = "acme"
api_key = "cosmo_..."
api_key_id = "8d1f1f16-0f5e-4a1a-9a1b-2c3d4e5f6a7b"
base_url = "https://platform.askcosmo.ai"
expires_at = "2026-11-01T20:11:39Z"
Each table is a profile. default is used unless COSMO_PROFILE or
--profile says otherwise — the environment variable matters because the SDKs
read this file from inside your own process, where a CLI flag cannot reach
them.
This file is a contract, not an implementation detail — several SDKs read it,
so the shape is pinned by tests in tests/test_credentials.py.
versionis file-level. A reader checks it once and then knows how to interpret every profile. A file from a newer CLI is refused rather than guessed at.- Profiles are named credential sets.
defaultis used unless a caller asks for another. A writer preserves profiles it does not recognise, so one SDK cannot drop another's data. base_urlis an origin with no path. SDKs append their own API paths; a stored/apisuffix would double up.
If another tool already owns a profile name and keys it differently, the
file is copied to credentials.bak (.bak.1, .bak.2, …) before that
profile is replaced, so nothing is overwritten without a copy.
Override the location with COSMO_CREDENTIALS_FILE — useful for tests and for
keeping work and personal credentials apart.
Install
Not published yet. From a checkout:
pipx install --editable ./tools/cosmo-cli
Development
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest
.venv/bin/pyright
Runtime dependencies are click and tomli-w — both pure Python, neither
with transitive dependencies of its own. A Homebrew formula needs a resource
block per transitive dependency, so each addition is recurring packaging work,
and a compiled one drags a build toolchain into the formula. For scale: typer
- rich would be 8 blocks, and pydantic ships a Rust extension.
Reading TOML is stdlib (tomllib); only writing it is not.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cosmo_cli-0.1.0.tar.gz.
File metadata
- Download URL: cosmo_cli-0.1.0.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49408c9a361d8017ea11990aa143a9b5b7109ee910d40f06019b68d6c66d4d3a
|
|
| MD5 |
2ff8d7a511e167b6849441be793cd8f2
|
|
| BLAKE2b-256 |
b0f96d97b323675e7a49ea977d06f52d14683cf3d02995a15be93ce8a051f7b5
|
Provenance
The following attestation bundles were made for cosmo_cli-0.1.0.tar.gz:
Publisher:
cosmo-cli-publish.yml on socratic-ai/cosmo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cosmo_cli-0.1.0.tar.gz -
Subject digest:
49408c9a361d8017ea11990aa143a9b5b7109ee910d40f06019b68d6c66d4d3a - Sigstore transparency entry: 2350837782
- Sigstore integration time:
-
Permalink:
socratic-ai/cosmo@d151e75fcf3f3e5a447b30c3a1649d08afed199d -
Branch / Tag:
refs/tags/cosmo-cli-v0.1.0 - Owner: https://github.com/socratic-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cosmo-cli-publish.yml@d151e75fcf3f3e5a447b30c3a1649d08afed199d -
Trigger Event:
push
-
Statement type:
File details
Details for the file cosmo_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cosmo_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c8434ad383cefaabb7f36c1ca7507612537b8139283bc2f19b4a6a6bc514b5b
|
|
| MD5 |
939814d81e5a3282282a576a16853da5
|
|
| BLAKE2b-256 |
5eb1786039b32eff99e70a3e8424d0a2a56775a2d86320e2f019b97df2dee048
|
Provenance
The following attestation bundles were made for cosmo_cli-0.1.0-py3-none-any.whl:
Publisher:
cosmo-cli-publish.yml on socratic-ai/cosmo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cosmo_cli-0.1.0-py3-none-any.whl -
Subject digest:
4c8434ad383cefaabb7f36c1ca7507612537b8139283bc2f19b4a6a6bc514b5b - Sigstore transparency entry: 2350837911
- Sigstore integration time:
-
Permalink:
socratic-ai/cosmo@d151e75fcf3f3e5a447b30c3a1649d08afed199d -
Branch / Tag:
refs/tags/cosmo-cli-v0.1.0 - Owner: https://github.com/socratic-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cosmo-cli-publish.yml@d151e75fcf3f3e5a447b30c3a1649d08afed199d -
Trigger Event:
push
-
Statement type: