@careerstudiomax/cstm2
v1.0.2
Published
Official JavaScript/TypeScript SDK for the CSTM-2 CareerStudioMax Model API
Downloads
403
Maintainers
Readme
CSTM-2 JavaScript / TypeScript SDK
Official client for the CareerStudioMax CSTM-2 API — 8 independent, career-native model families.
Install
npm install @careerstudiomax/cstm2Quickstart
const { CSTM2Client } = require('@careerstudiomax/cstm2');
// or: import { CSTM2Client } from '@careerstudiomax/cstm2';
const client = new CSTM2Client('cstm_lm_your_key_here');
const { choices } = await client.careerlm.chat({
messages: [{ role: 'user', content: 'Write a cover letter opener for a Senior PM role' }],
});
console.log(choices[0].message.content);Streaming
chatStream is a sibling of chat, not nested under it:
await client.careerlm.chatStream(
{ messages: [{ role: 'user', content: 'Draft a resignation letter' }] },
(event) => process.stdout.write(event.text || ''),
);Every other streaming family follows the same shape — careeragent.runStream,
careeragent.jobSearchStream, and careerwebapi.searchStream all take
(request, onEvent) and resolve once the stream closes:
await client.careeragent.runStream(
{ task: 'Find 5 remote senior PM roles at Series B startups' },
(event) => { if (event.type === 'text') process.stdout.write(event.text); },
);Generate career documents
careerlm.generate was previously broken — the backend endpoint is
SSE-only, but this method called it as a plain JSON request and threw a
parse error on every real call. Fixed: it now streams internally and
resolves with the full assembled text once done (pass a second onEvent
argument for live token-by-token updates, exactly like chatStream):
const { text } = await client.careerlm.generate({
type: 'cover-letter', // or 'cv-summary' | 'linkedin-about' | 'exec-bio'
role: 'Senior Product Manager',
company: 'Acme Inc',
country: 'UK',
});
console.log(text);Each model family needs its own key
A cstm_lm_* key only works on careerlm endpoints; a cstm_em_* key only works on careerembed, and so on. Generate one key per family you use at careerstudiomax.com/developer.
| Family | Client namespace | Key prefix |
|---|---|---|
| CareerLM | client.careerlm | cstm_lm_ |
| CareerEmbed | client.careerembed | cstm_em_ |
| CareerScore | client.careerscore | cstm_sc_ |
| CareerAgent | client.careeragent | cstm_ag_ |
| CareerVoice | client.careervoice | cstm_vc_ |
| CareerVision | client.careervision | cstm_vi_ |
| CareerVideo | client.careervideo | cstm_vd_ |
| CareerWebAPI | client.careerwebapi | cstm_wb_ |
Errors
All errors throw CSTM2Error (message, code, status).
const { CSTM2Client, CSTM2Error } = require('@careerstudiomax/cstm2');
try {
await client.careerembed.embed('some text');
} catch (e) {
if (e instanceof CSTM2Error) console.error(e.code, e.status, e.message);
}Full endpoint reference: careerstudiomax.com/developer
