SDK installation
Modaic's Python and TypeScript SDKs are typed, HTTP-only clients for the public API. They do not interact with Git or read and write repository files.
Install
pip install modaic
Python requires version 3.11 or later and includes matching synchronous and asynchronous clients. TypeScript requires Node.js 18 or later, uses the standard Fetch API, and has no runtime dependencies.
Create an API key in the Modaic dashboard, then export it:
export MODAIC_API_KEY="mdc_..."
The Python package also supplies the modaic CLI. See the
CLI reference for commands and browser login.
Stored browser login authenticates CLI commands; programmatic Modaic and
AsyncModaic clients still use API keys.
Create a client
from modaic import Modaic
with Modaic() as modaic:
models = modaic.models.list()
print([model.name for model in models.models])
Python responses are Pydantic models. TypeScript methods return promises and export their request and response types from the package.
Async Python
AsyncModaic exposes the same resources and method names as the synchronous
client:
import asyncio
from modaic import AsyncModaic
async def main() -> None:
async with AsyncModaic() as modaic:
models = await modaic.models.list()
print([model.name for model in models.models])
asyncio.run(main())
Configuration
from modaic import Modaic
modaic = Modaic(
api_key="mdc_...",
timeout=30.0,
)
| Setting | Python | TypeScript | Environment variable | Default |
|---|---|---|---|---|
| API key | api_key | apiKey | MODAIC_API_KEY | Required |
| Request timeout | timeout | timeoutMs | — | 30 seconds |