Scan your whole stack
From OX Research Newsroom
Are you using segmind?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.0.0-next-20261126114529
segmind was last scanned on 26 Nov 2026 at version 0.0.0-next-20261126114529. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.0.0-next-20261126114529 LATEST | 26 Nov 2026 | No rules fired |
| 0.6.1 | 24 Nov 2026 | No rules fired |
| 0.0.0-next-20261124120601 | 24 Nov 2026 | No rules fired |
| 0.6.0 | 18 Nov 2026 | Not shown |
| 0.0.0-next-20261118105731 | 18 Nov 2026 | Not shown |
Findings for v0.0.0-next-20261126114529. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.0.0-next-20261126114529; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
The official JavaScript SDK for Segmind: image, video, audio and LLM models through one API. It works in Node 22+, and in browsers and React Native through your own backend.
0.x. Until 1.0, a breaking change bumps the minor version, so pin the minor you build on, such as
segmind@~0.6, if you need the API to hold still.
npm install segmind
export SEGMIND_API_KEY="your_api_key"
import { Segmind } from 'segmind';
const segmind = new Segmind(); // reads SEGMIND_API_KEY
// Async by default: submits to the queue and waits for the result.
const result = await segmind.run('seedream-4.5', {
prompt: 'A beautiful sunset over mountains',
aspect_ratio: '16:9',
});
console.log(result.output);
The module-level functions use a client built from SEGMIND_API_KEY:
import * as segmind from 'segmind';
const result = await segmind.run('seedream-4.5', { prompt: 'A cyberpunk city at night' });
Model inputs go in the second argument exactly as the model page lists them. Call options (timeout, interval, signal) go in the third, so a model input named timeout still reaches the model.
const response = await segmind.runSync('seedream-4.5', { prompt: 'A sunset' });
const image = new Uint8Array(await response.arrayBuffer()); // or response.json() for JSON models
runSync is never retried, because each call bills.
const job = await segmind.submit('seedance-2.0', { prompt: 'A sunset timelapse' });
console.log(job.requestId);
const result = await job.wait({
timeout: 15 * 60_000,
interval: (elapsed) => (elapsed < 30_000 ? 2_000 : 5_000), // or a fixed number of ms
onStatus: (status) => console.log(status.status),
});
A submit carries an X-Request-ID. If the connection drops, the SDK sends it again with the same id, and the gateway returns the existing request instead of starting (and billing) a second one. Pass your own requestId to make a submit idempotent across restarts.
To pick a job up later, such as after a page reload, keep its id and rebuild it:
const job = segmind.job(savedRequestId);
const result = await job.wait();
The result is kept for about an hour, and only for the user who submitted the job. Anything else reads as a SegmindError with status 404.
const reply = await segmind.chat('gpt-5.5', { prompt: 'Write a haiku about the sea' });
console.log(reply.text, reply.usage, reply.finishReason);
// Structured output
const person = await segmind.chat('gpt-5.5', {
prompt: 'Invent one person.',
response_format: {
type: 'json_schema',
json_schema: {
name: 'person',
strict: true,
schema: {
type: 'object',
properties: { name: { type: 'string' }, age: { type: 'integer' } },
required: ['name', 'age'],
additionalProperties: false,
},
},
},
});
console.log(person.json());
// Images in a message
import { imageUrl } from 'segmind';
const described = await segmind.chat('gpt-5.5', {
messages: [{ role: 'user', content: [{ type: 'text', text: "What's in this image?" }, await imageUrl('cat.png')] }],
});
reply.text reads the assistant text from OpenAI, Anthropic and Gemini replies alike; reply.raw is the provider's own JSON. chatSync makes one blocking call, and submitChat returns a job.
const { url } = await segmind.files.upload('portrait.jpg'); // a path (Node), a Blob/File, or bytes
const result = await segmind.run('some-image-to-image-model', { image: url });
Each file goes straight to storage on a presigned URL, so large videos never travel as base64 JSON. By default the URLs are public and temporary (kept for at least two days): they are for passing files to models, not for keeping them. Pass an array to upload several, in order. Bytes without a name need { filename: 'clip.mp4' } unless their type can be read from the first bytes.
To keep a file, pass persist: true. It is saved to your asset library and its URL does not expire, the same as the Python SDK's upload:
const logo = await segmind.files.upload('logo.png', { persist: true });
logo.url; // https://images.segmind.com/assets/…
logo.persistent; // true
Persistent uploads take images, video, audio, PDF and common document types, up to 2 GB each.
const page = await segmind.models.list({ q: 'upscale', output: 'image', limit: 20 });
page.models; // slug, name, category, average_cost, latency_seconds, ...
const videoModels = await segmind.models.listAll({ output: 'video', sort: 'cheapest' });
list returns one page (has_more, offset, total); listAll reads every page. average_cost is observed spend, not the list price.
const page = await segmind.generations.list({ modelName: 'flux-schnell', perPage: 50 });
const theirs = await segmind.generations.list({ userEmail: 'teammate@example.com' }); // inside a team
const history = await segmind.generations.history({ status: 'FAILED', perPage: 50 }); // failures included
const fromKey = await segmind.generations.history({ keySuffix: 'a1b2c3', initiator: ['API', 'API_V2'] });
const one = await segmind.generations.get(requestId);
const latest = await segmind.generations.recent('flux-schnell');
history lists one row per output, each with the request's full cost: de-duplicate on request_id before summing credits_deduction. Each row carries its initiator and the key_mask of the key that made it. Filter by key with keySuffix, the last 6 characters of the key: the full key is never sent.
Inside a team, list and history narrow to one member with userId or userEmail, one or the other; outside a team only your own id or email is accepted.
const hook = await segmind.webhooks.add('https://example.com/hooks/segmind', ['PIXELFLOW']);
const hooks = await segmind.webhooks.get(); // each with its signing_secret
await segmind.webhooks.update(hook.id, 'https://example.com/hooks/v2'); // URL only
await segmind.webhooks.test(hook.id); // a WEBHOOK_TEST delivery
const deliveries = await segmind.webhooks.logs(hook.id);
await segmind.webhooks.resend(deliveries[0].id); // that payload again
await segmind.webhooks.delete(hook.id);
Event types are subscription types: PIXELFLOW for PixelFlow runs, plus WORKFLOW, INFERENCE and FINETUNE. update changes the URL only; to change the event types, delete the registration and add a new one. Before 0.2.4, update registered a second hook and delete deactivated nothing, so check webhooks.get() for registrations left behind.
test and resend each send a real delivery, in the background after they return: read logs to see how your endpoint answered. Neither is retried, since every attempt is another delivery.
const result = await segmind.pixelflows.run('your-workflow-slug', { Text_Prompt: 'An infographic about tea' });
console.log(result.outputs); // { image_out: 'https://…' }
const job = await segmind.pixelflows.submit('your-workflow-slug', { Text_Prompt: '…' });
const done = await job.wait({ timeout: 20 * 60_000, interval: 5_000 });
The slug is the workflow's API slug from its API tab, and inputs are keyed by each input's keyname. Runs use the current workflow engine; pass { engine: 'v1' } for the legacy one. A failed run throws InferenceFailed whose detail names the node that failed. A submit is never retried, because a run bills.
Session models (speech-to-speech and other live models) run as a session over
a WebSocket rather than as a request. The session code lives in
segmind/realtime, so an app that never opens a session never loads it. It
runs unchanged in browsers, React Native and Node.
1. Your backend mints a token. A token opens one session of one model and caps what it may spend, so it is safe to hand to a browser or a phone. The API key stays on the server.
// server
import { Segmind } from 'segmind';
const segmind = new Segmind(); // SEGMIND_API_KEY
app.post('/api/realtime-token', async (req, res) => {
res.json(await segmind.realtime.createToken({ slug: req.body.slug, creditCeiling: 1 }));
});
2. The app opens the session with only a token provider.
// browser
import { connect } from 'segmind/realtime';
import { startVoice } from 'segmind/realtime/browser';
const session = await connect('your-session-model', {
tokenProvider: (slug) =>
fetch('/api/realtime-token', { method: 'POST', body: JSON.stringify({ slug }) }).then((r) => r.json()),
params: { voice: 'eve' },
});
session.on('transcript.delta', (e) => console.log(e.role, e.text));
const voice = await startVoice(session); // call from a click: microphone, playback, barge-in
voice.muted = true; // stop sending microphone audio
const { usage } = await session.close(); // resolves after the session is settled
await voice.stop();
console.log(usage?.cost);
From Node, mint with the client's own key:
connect(slug, { tokenProvider: segmind.realtime.tokenProvider() }), then
session.sendText(...) or session.sendAudio(pcm) (16-bit PCM at
session.audio.rate) and read audio.delta events.
session.end.reason:
client, ceiling, idle, max_length, balance_exhausted,
upstream_error and the rest. close() and whenEnded() resolve with the
final usage.connect() rejects with a SessionOpenError (a
SegmindError) whose code says why, such as insufficient_credits,
unauthorized (a token minted for another model, for example),
token_expired, unknown_model, capacity or service_unavailable. The
RefusalCode type in segmind/realtime lists them all. capacity and
service_unavailable are worth retrying shortly; the rest are not.signal to cancel an open or end a live session.In React, @segmind/react wraps
a session in one hook, useRealtimeSession.
const { credits, freeCredits } = await segmind.accounts.credits();
credits is the stored balance of the account or team making the request. Credits held by requests still running are not taken off.
| Error | When |
|---|---|
SegmindError |
Any error from the SDK. status, detail (the server's message), requestId and body when known |
APIConnectionError |
No response: network failure or the client timeout |
InferenceFailed |
A queued request reached FAILED; detail holds the reason |
InferenceTimeout |
wait() passed its timeout. The request may still finish: call job.wait() again |
InsufficientCredits |
The account can't pay for the request, at submit or as a failed job. detail holds the reason |
RateLimited |
Too many requests, after any retries. retryAfterMs is set when the server sent Retry-After and the runtime could read it |
Reads, polls and queued submits retry connection errors and 429, 502, 503 and 504, honouring Retry-After; reads also retry 408.
new Segmind({
apiKey: '...', // default: SEGMIND_API_KEY
baseURL: 'https://api.segmind.com', // default: SEGMIND_BASE_URL or this
timeout: 600_000, // ms per HTTP request
maxRetries: 2,
fetch: customFetch, // any fetch implementation
initiator: 'API', // how these requests are labelled in usage history; default SDK-JS
initiatorId: 'batch-42', // what they belong to, also settable per call
});
The constructor refuses an API key in a browser or React Native app, because every user of the app could read it. Call Segmind from your backend. Pass dangerouslyAllowBrowser: true only for internal tools where that is acceptable.
An app where people sign in with their Segmind account can send the user's own session token instead of an API key. This works in a browser, because the token only reaches what that user could do anyway.
const segmind = new Segmind({
tokenProvider: () => auth.getToken(), // called before every request
onUnauthorized: () => auth.refresh(), // on a 401; a new token retries the request once
});
Pass apiKey or tokenProvider, not both.
Apache-2.0
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.