Skip to main content

cosmo

Set up 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 init       # sign in, install the Cosmo skill, print what to do next

That is the whole setup. Underneath it are four commands you can also run on their own:

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

cosmo init reuses a credential that already works rather than replacing one the SDKs are using; only cosmo login retires and re-mints unconditionally.

The Agent Skill

cosmo init also installs the Cosmo Agent Skill to ~/.claude/skills/cosmo/, which teaches a coding agent the current SDK API across all three languages. Skip it with cosmo init --no-skill.

Two routes, in order:

  1. skills add socratic-ai/cosmo-ai --skill cosmo --global --yes — through a skills executable if one is on PATH, else through npx. Both flags are load-bearing: without --skill the installer takes every skill the repository contains, and without --global it writes them into the current working directory. Named this way, a source that cannot supply cosmo installs nothing at all.
  2. The copy bundled in this package, whenever the fetch does not leave a SKILL.md at the target — including the exit-0-but-installed-nothing case, which is why the check is the file rather than the exit code.

Route 2 is why this never requires Node, and it is the route in use today.

The bundled copy is cosmo/skill_data/, a copy of sdks/cosmo-realtime/skills/cosmo/. Edit the skill in the SDK tree and re-copy; tests/test_skill.py asserts the two are byte-identical, so drift fails in CI rather than shipping one version to npm and another to PyPI.

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.

  • version is 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. default is used unless a caller asks for another. A writer preserves profiles it does not recognise, so one SDK cannot drop another's data.
  • base_url is an origin with no path. SDKs append their own API paths; a stored /api suffix 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

pipx install cosmo-cli

Or into any Python 3.11+ environment: pip install 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.

Release files for cosmo-cli 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cosmo-cli 0.1.2
File Size Uploaded
cosmo_cli-0.1.2.tar.gz 41.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cosmo-cli 0.1.2
File Interpreter ABI Platform
cosmo_cli-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 90.4 kB

Release files / cosmo_cli-0.1.2.tar.gz

Download URL cosmo_cli-0.1.2.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
100c5bea4fb1ec12b8f25ded07f59de54b0cb108b50ec3fa203baa5cf21d370e
BLAKE2b-256 checksum
How to use checksums
c1f7f4e487612fc76a295c9c5b85a02a156d90a7c8db288fc2bbf711179e5b2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release files / cosmo_cli-0.1.2-py3-none-any.whl

Download URL cosmo_cli-0.1.2-py3-none-any.whl
Size 49.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30645db888481d5689b9a78bb7693b3c09eaa9e4dcec8c8ed76c03a24f99c7b3
BLAKE2b-256 checksum
How to use checksums
93588acc50c841dd5ad32a37c62171f8e093d4ce3631142f456f165eed0f0a12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page