@ohm_studio/cli
v0.1.0
Published
OHM Studio CLI — pull your published Studio API schemas and emit typed TypeScript interfaces. Pairs with @ohm_studio/sdk for end-to-end type safety.
Downloads
139
Maintainers
Readme
@ohm_studio/cli
Codegen tool for OHM Studio. Pull your published Studio API schemas and
emit typed TypeScript interfaces — pair with @ohm_studio/sdk for
end-to-end type safety.
Install
npm i -D @ohm_studio/cli
# or globally
npm i -g @ohm_studio/cliQuick start
export OHM_API_KEY=ohms_live_xxx
# One API
ohm-studio pull opd-clinic
# → ./ohm-types/opd-clinic.ts
# All published APIs
ohm-studio pull-all --out src/ohm
# What's published?
ohm-studio listUse the generated types
import { OHM } from "@ohm_studio/sdk";
import type { OpdClinicData } from "./ohm-types/opd-clinic";
const ohm = new OHM({ apiKey: process.env.OHM_API_KEY! });
const { data } = await ohm.extract<OpdClinicData>({
apiSlug: "opd-clinic",
text: transcript,
});
// `data` is typed against the schema you defined in Studio
data.diagnoses.forEach((d) => console.log(d.name, d.code));Pre-build hook
Add codegen to your package.json so types stay in sync with Studio:
{
"scripts": {
"predev": "ohm-studio pull-all --out src/ohm",
"prebuild": "ohm-studio pull-all --out src/ohm"
}
}Programmatic API
import { pull, generateTypes } from "@ohm_studio/cli";
await pull({
slug: "opd-clinic",
apiKey: process.env.OHM_API_KEY!,
baseUrl: "https://api.ohm.doctor",
outDir: "./generated",
});Auth
The CLI accepts:
- API keys (
ohms_live_*,ohms_test_*) — project-scoped - Studio user JWTs — organization-wide
Pass either via OHM_API_KEY env var or --key <token>.
License
MIT
