com um clique
dust-llm
// Step-by-step guide for adding support for a new LLM in Dust. Use when adding a new model, or updating a previous one.
// Step-by-step guide for adding support for a new LLM in Dust. Use when adding a new model, or updating a previous one.
Add a new audit log event in `front`. Use when instrumenting a new user or system action for WorkOS audit logging, including schema creation, `AuditAction` updates, and the correct emit call after the mutation path.
Implement a new built-in webhook source provider in `front`. Use when adding a webhook provider such as Linear, GitHub, or Fathom, including provider research, OAuth prerequisites, provider-specific types and client code, preset registration, UI components, and end-to-end testing.
Write and refactor React forms using react-hook-form with Zod validation. Use when creating new form components, converting existing forms to react-hook-form, or implementing form validation patterns.
Writes React components without unnecessary useEffect. Use when creating/reviewing React components, refactoring effects, or when code uses useEffect to transform data or handle events.
Step-by-step guide for creating new internal MCP server integrations in Dust that connect to remote platforms (Jira, HubSpot, Salesforce, etc.). Use when adding a new MCP server, implementing a platform integration, or connecting Dust to a new external service.
Create, migrate, or query Elasticsearch indices in `front`. Use when adding a new front Elasticsearch index, changing mappings or settings, wiring indexing logic, or exposing Elasticsearch-backed analytics/search endpoints.
| name | dust-llm |
| description | Step-by-step guide for adding support for a new LLM in Dust. Use when adding a new model, or updating a previous one. |
This skill guides you through adding support for a newly released LLM.
| File | Purpose |
|---|---|
front/types/assistant/models/{provider}.ts | Model ID + configuration |
front/lib/api/assistant/token_pricing.ts | Pricing per million tokens |
front/types/assistant/models/models.ts | Central registry |
front/lib/api/llm/clients/{provider}/types.ts | Router whitelist |
sdks/js/src/types.ts | SDK types |
front/components/providers/types.ts | UI availability (optional) |
front/lib/api/llm/tests/llm.test.ts | Integration tests |
Before adding, gather:
gpt-4-turbo-2024-04-09)Edit front/types/assistant/models/openai.ts:
export const GPT_4_TURBO_2024_04_09_MODEL_ID = "gpt-4-turbo-2024-04-09" as const;
export const GPT_4_TURBO_2024_04_09_MODEL_CONFIG: ModelConfigurationType = {
providerId: "openai",
modelId: GPT_4_TURBO_2024_04_09_MODEL_ID,
displayName: "GPT 4 turbo",
contextSize: 128_000,
recommendedTopK: 32,
recommendedExhaustiveTopK: 64,
largeModel: true,
description: "OpenAI's GPT 4 Turbo model for complex tasks (128k context).",
shortDescription: "OpenAI's second best model.",
isLegacy: false,
isLatest: false,
generationTokensCount: 2048,
supportsVision: true,
supportedReasoningEfforts: {
none: true,
light: true,
medium: true,
high: true,
},
defaultReasoningEffort: "none",
supportsResponseFormat: false,
tokenizer: { type: "tiktoken", base: "cl100k_base" },
};
Edit front/lib/api/assistant/token_pricing.ts:
const CURRENT_MODEL_PRICING: Record<BaseModelIdType, PricingEntry> = {
// ... existing
"gpt-4-turbo-2024-04-09": {
input: 10.0, // USD per million input tokens
output: 30.0, // USD per million output tokens
cache_read_input_tokens: 1.0, // Optional: cached reads
cache_creation_input_tokens: 12.5, // Optional: cache creation
},
};
Edit front/types/assistant/models/models.ts:
export const MODEL_IDS = [
// ... existing
GPT_4_TURBO_2024_04_09_MODEL_ID,
] as const;
export const SUPPORTED_MODEL_CONFIGS: ModelConfigurationType[] = [
// ... existing
GPT_4_TURBO_2024_04_09_MODEL_CONFIG,
];
Edit front/lib/api/llm/clients/openai/types.ts:
export const OPENAI_WHITELISTED_MODEL_IDS = [
// ... existing
GPT_4_TURBO_2024_04_09_MODEL_ID,
] as const;
Edit sdks/js/src/types.ts:
const ModelLLMIdSchema = FlexibleEnumSchema<
// ... existing
| "gpt-4-turbo-2024-04-09"
>();
Edit front/components/providers/types.ts:
export const USED_MODEL_CONFIGS: readonly ModelConfig[] = [
// ... existing
GPT_4_TURBO_2024_04_09_MODEL_CONFIG,
] as const;
Edit front/lib/api/llm/tests/llm.test.ts:
const MODELS = {
// ... existing
[GPT_4_TURBO_2024_04_09_MODEL_ID]: {
runTest: true, // Enable for testing
providerId: "openai",
},
};
Run test:
RUN_LLM_TEST=true npx vitest --config lib/api/llm/tests/vite.config.js lib/api/llm/tests/llm.test.ts --run
After test passes, set runTest: false to avoid expensive CI runs.
Same pattern with Anthropic-specific files:
front/types/assistant/models/anthropic.ts - Add CLAUDE_X_MODEL_ID and configfront/lib/api/llm/clients/anthropic/types.ts - Add to ANTHROPIC_WHITELISTED_MODEL_IDSfront/types/assistant/models/models.ts - Register in central registryfront/lib/api/assistant/token_pricing.ts - Add pricingsdks/js/src/types.ts - Update SDK types| Property | Description |
|---|---|
supportsVision | Can process images |
supportsResponseFormat | Supports structured output (JSON) |
supportedReasoningEfforts | Supported reasoning levels (none, light, medium, high) |
defaultReasoningEffort | Default reasoning level |
tokenizer | Tokenizer config for token counting |
MODEL_IDS + SUPPORTED_MODEL_CONFIGS)Model not in UI: Check USED_MODEL_CONFIGS in front/components/providers/types.ts
API calls failing: Verify model ID matches provider's exact identifier, check router whitelist
Token counting errors: Validate context size and tokenizer configuration
Pricing issues: Ensure prices are per million tokens in USD
front/types/assistant/models/openai.ts and anthropic.ts for examples