xiaohongshu
xiaohongshu
add-provider
Add a new AI provider or model for recipe generation. Use when adding support for a new LLM provider (Anthropic, Google, etc.) or adding models to an existing provider.
Full skill instructions
To add a new provider:
app/lib/providers/{provider-name}/prompts.ts with model-specific promptsindex.ts implementing the RecipeProvider interfaceapp/lib/providers/index.tsapp/recipes/page.tsxbun add @{provider-name}/sdkWarning: API parameters can change between model versions! For example, OpenAI's
gpt-4o-miniusesmax_tokenswhilegpt-5-miniusesmax_completion_tokens. Always check the provider's docs for each specific model.
app/lib/providers/
├── index.ts # Provider registry + factory
├── types.ts # Shared provider interfaces
├── base.ts # Base provider class with shared logic
├── openai/
│ ├── index.ts # OpenAI provider implementation
│ └── prompts.ts # OpenAI-specific prompts
└── {your-provider}/
├── index.ts # Your provider implementation
└── prompts.ts # Your provider's prompts
mkdir -p app/lib/providers/{provider-name}
prompts.ts)Define the system prompt and user prompt template optimized for your model:
export const SYSTEM_PROMPT = `You are an expert Colorist...`
export const USER_PROMPT_TEMPLATE = (analysisJson: string) =>
`Pre-processing data:\n${analysisJson}\n\nAnalyze this image and create a Ricoh GR III recipe.`
See app/lib/providers/openai/prompts.ts for the full prompt structure.
index.ts)import { BaseProvider, transformToRecipe } from '../base'
import { registerProvider } from '../index'
import type { GenerateRecipeResponse, ModelConfig, ProviderConfig } from '../types'
import type { ImageAnalysis } from '../../types'
import { SYSTEM_PROMPT, USER_PROMPT_TEMPLATE } from './prompts'
class YourProvider extends BaseProvider {
readonly config: ProviderConfig = {
id: 'your-provider',
name: 'Your Provider',
models: [
{
id: 'model-id-here',
name: 'Model Display Name',
systemPrompt: SYSTEM_PROMPT,
userPromptTemplate: USER_PROMPT_TEMPLATE,
maxTokens: 8000,
},
],
defaultModel: 'model-id-here',
}
async generateRecipe(
imageBase64: string,
mimeType: string,
analysis: ImageAnalysis,
modelId?: string
): Promise<GenerateRecipeResponse> {
const model = this.getModelOrDefault(modelId)
const analysisJson = JSON.stringify(analysis, null, 2)
// Call your provider's API here
// Parse the response
// Use transformToRecipe() from base.ts to convert to LLMRecipe
const recipe = transformToRecipe(parsed)
return {
recipe,
reasoning: parsed.reasoning || '',
model: model.id,
provider: this.config.id,
}
}
}
const provider = new YourProvider()
export function register(): void {
registerProvider(provider)
}
export { provider }
In app/lib/providers/index.ts, add the import at the bottom:
import('./your-provider').then((m) => m.register()).catch(console.error)
In app/recipes/page.tsx, add your models to MODEL_DISPLAY_NAMES:
const MODEL_DISPLAY_NAMES: Record<string, string> = {
// ... existing models
'your-model-id': 'Display Name',
}
Add required API keys to .env.local:
YOUR_PROVIDER_API_KEY=sk-xxx
Optionally set the default model:
RECIPE_MODEL=your-model-id
interface ProviderConfig {
id: string // Unique ID: 'openai', 'anthropic'
name: string // Display name: 'OpenAI', 'Anthropic'
models: ModelConfig[]
defaultModel: string // Default model ID
}
interface ModelConfig {
id: string // Model ID from provider
name: string // Human-readable name
systemPrompt: string // System prompt for this model
userPromptTemplate: (json: string) => string // User prompt template
maxTokens: number // Max completion tokens
}
interface GenerateRecipeResponse {
recipe: LLMRecipe // Transformed recipe
reasoning: string // AI's reasoning
model: string // Model ID used
provider: string // Provider ID used
}
base.ts)transformToRecipe(parsed) - Convert raw API response to LLMRecipetransformWhiteBalance(wb) - Convert white balance formattransformCorrection(value) - Normalize correction enum valuesclamp(value, min, max) - Clamp numbers to valid rangesThe model must output JSON matching this schema:
| Field | Type | Range/Values |
|---|---|---|
| recipe_name | string | Evocative name |
| image_control_mode | enum | Standard, Vivid, Monotone, etc. |
| saturation | integer | -4 to 4 |
| hue | integer | -4 to 4 |
| high_low_key | integer | -4 to 4 |
| contrast | integer | -4 to 4 |
| contrast_highlight | integer | -4 to 4 |
| contrast_shadow | integer | -4 to 4 |
| sharpness | integer | -4 to 4 |
| shading | integer | -4 to 4 |
| clarity | integer | -4 to 4 |
| grain_effect | integer | 0 to 3 |
| white_balance | object | mode, color_temperature_k, compensation_a, compensation_g |
| highlight_correction | enum | Auto, On, Off |
| shadow_correction | enum | Auto, Low, Medium, High, Off |
| peripheral_illumination_correction | boolean | |
| high_iso_noise_reduction | enum | Auto, Low, Medium, High, Off, Custom |
| reasoning | string | 2-4 sentences |
See REFERENCE.md for full implementation details. See examples/anthropic.md for a complete example.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience