Core types
Public core types and declarations exported from @nirmos/sdk.
Import these names from @nirmos/sdk. Optional fields may be absent; nullable fields may be null. Dates in management DTOs remain strings. These declarations do not imply provider support or runtime implementation. Use TypeScript support for indexed DTOs.
NirmosOptions
export interface NirmosOptions {
projectId?: string;
auth: NirmosAuth;
apiBaseUrl?: string;
runtimeBaseUrl?: string;
timeoutMs?: number;
maxRetries?: number;
fetch?: typeof globalThis.fetch;
headers?: HeadersInput;
promptCache?: PromptCacheConfig | false;
/** Observe HTTP failures centrally, without changing method error semantics. */
onError?: (error: APIError) => void;
}NirmosAuth
The following aliases select the server authentication variants from the exported union. They describe a subset, rather than redefining the complete SDK type. Use API keys by default; Bearer transport is advanced.
import type { NirmosAuth } from "@nirmos/sdk";
type ApiKeyAuth = Extract<NirmosAuth, { type: "api-key" }>;
type BearerAuth = Extract<NirmosAuth, { type: "access-token" }>;EndpointExecution
export interface EndpointExecution {
success: boolean;
data: {
output: unknown;
raw_content?: string;
model: string;
provider: string;
output_valid: boolean;
repair_attempts: number;
};
usage: {
prompt_tokens: number;
completion_tokens: number;
total_tokens: number;
};
meta: {
endpoint_id: string;
version_id: string;
prompt_version_id: string;
request_id: string;
trace_id: string;
latency_ms: number;
};
}KnowledgeMatch
export type KnowledgeMatch = KnowledgeSearchResponse["items"][number];KnowledgeSearchRequest
export type KnowledgeSearchRequest = Requests["searchKnowledgeBase"];KnowledgeSearchResponse
export type KnowledgeSearchResponse = Responses["searchKnowledgeBase"];KnowledgeSearchMode
export type KnowledgeSearchMode = KnowledgeSearchResponse["mode"];KnowledgeSearchStatus
export type KnowledgeSearchStatus = Responses["getKnowledgeSearchStatus"];PromptTestRequest
export interface PromptTestRequest {
privacy?: {
inputLogging?: false;
outputLogging?: false;
cache?: false;
history?: false;
};
messages: Array<{
role: string;
name?: string | null;
order?: number;
contentBlocks: Array<{
order?: number;
type: string;
text?: string | null;
uri?: string | null;
mimeType?: string | null;
data?: unknown;
}>;
}>;
selectedModel?: string;
temperature?: number;
maxTokens?: number;
topP?: number;
variables?: string[];
variablesInput?: Record<string, unknown>;
provider?: string;
structuredOutput?: unknown;
}PromptTestResponse
export interface PromptTestResponse {
success: boolean;
data?: {
output?: unknown;
raw_content?: string;
model?: string;
provider?: string;
output_valid?: boolean;
repair_attempts?: number;
structuredOutput?: {
validationPassed?: boolean;
validationErrors?: string[];
healingDetails?: {
llmRetryUsed?: boolean;
programmaticApplied?: boolean;
};
};
};
error?: string;
usage?: {
prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
};
meta?: {
latency_ms?: number;
request_id?: string;
trace_id?: string;
};
}HeadersInput
export type HeadersInput = Headers | Readonly<Record<string, string>> | readonly (readonly [
string,
string
])[];JsonPrimitive
export type JsonPrimitive = string | number | boolean | null;JsonValue
export type JsonValue = JsonPrimitive | {
readonly [key: string]: JsonValue;
} | readonly JsonValue[];Page
export interface Page<T> {
data: readonly T[];
hasMore: boolean;
nextCursor?: string;
}RequestMetadata
export interface RequestMetadata {
requestId?: string;
traceId?: string;
provider?: string;
model?: string;
latencyMs?: number;
cache?: {
status?: string;
layer?: string;
remainingTtlSeconds?: number;
};
}RequestOptions
export interface RequestOptions {
/** Selected project; project API keys cannot change their bound project. */
projectId?: string;
/** Cancels this request when aborted. */
signal?: AbortSignal;
/** Overrides the client timeout for this request. Set to 0 to disable. */
timeoutMs?: number;
/** Adds headers to this request. Client authentication headers cannot be overridden. */
headers?: HeadersInput;
/** Enables safe retries for a mutation when the API supports this key. */
idempotencyKey?: string;
/** Overrides the configured retry count for this request. */
maxRetries?: number;
}Usage
export interface Usage {
inputTokens: number;
outputTokens: number;
totalTokens: number;
cachedTokens?: number;
reasoningTokens?: number;
}Requests
Indexed management DTO map. Use Requests["operationId"]; method pages list their exact operation IDs, required fields and responses. Operations without a body or query map to undefined.
import type { Requests } from "@nirmos/sdk";
type ModelRequests = Requests["createModel"];Queries
Indexed management DTO map. Use Queries["operationId"]; method pages list their exact operation IDs, required fields and responses. Operations without a body or query map to undefined.
import type { Queries } from "@nirmos/sdk";
type ModelQueries = Queries["listModels"];Responses
Indexed management DTO map. Use Responses["operationId"]; method pages list their exact operation IDs, required fields and responses. Operations without a body or query map to undefined.
import type { Responses } from "@nirmos/sdk";
type ModelResponses = Responses["listModels"];EvaluationEvaluatorVersion
/** Built-in evaluator versions are discriminated by type. Configs follow the API schemas. */
export type EvaluationEvaluatorVersion = Requests["createEvaluatorVersion"];EvaluationEvaluatorType
export type EvaluationEvaluatorType = EvaluationEvaluatorVersion["type"];EvaluationEvaluatorConfig
export type EvaluationEvaluatorConfig<T extends EvaluationEvaluatorType> = Extract<EvaluationEvaluatorVersion, {
type: T;
}>["config"];EvaluationExpression
export type EvaluationExpression = EvaluationEvaluatorConfig<"custom_expression">["expression"];EvaluationTargetConfig
export type EvaluationTargetConfig = NonNullable<Requests["createEvaluationColumn"]["target"]>;EvaluationColumnCreate
export type EvaluationColumnCreate = Requests["createEvaluationColumn"];EvaluationInputBinding
export type EvaluationInputBinding = NonNullable<NonNullable<EvaluationColumnCreate["config"]>["inputMapping"]>[string];EvaluationSegmentCriteria
export type EvaluationSegmentCriteria = Requests["createSegment"]["criteria"];DataPolicy
export type DataPolicy = Requests["updateOrganizationPrivacy"]["policy"];PrivacyOperation
export type PrivacyOperation = Responses["getPrivacyOperation"];Conversation
export type Conversation = Responses["getConversation"];ImageStorageOptions
export type ImageStorageOptions = NonNullable<ImageRequest["storage"]>;