Getting Started
Configuration
Nuxt AI can be configured with several options.
To configure the Nuxt AI module and customize its behavior, you can use the ai
property in your nuxt.config
:
nuxt.config.ts
export default defineNuxtConfig({
ai: {
// Options
}
})
Core Configuration
keys
Configure API keys for various AI providers. It's recommended to use environment variables rather than hardcoding these values.
nuxt.config.ts
export default defineNuxtConfig({
ai: {
keys: {
openaiApiKey: import.meta.env.OPENAI_API_KEY,
anthropicApiKey: import.meta.env.ANTHROPIC_API_KEY,
// Add other provider keys as needed
}
}
})
options
Configure module behavior and features.
nuxt.config.ts
export default defineNuxtConfig({
ai: {
options: {
rules: true, // Enable AI assistant rules
}
}
})
MCP Server Configuration
The Model Context Protocol (MCP) server provides additional development tools and can be configured with the mcp
option.
mcp.enabled
Toggle the MCP server on or off. Default is true
in development and false
in production.
nuxt.config.ts
export default defineNuxtConfig({
ai: {
dev: {
mcp: {
enabled: true
}
}
}
})
Rules Configuration
Nuxt AI comes with pre-defined rules for AI assistants like Cursor and Claude. These can be enabled or disabled using the rules
option.
nuxt.config.ts
export default defineNuxtConfig({
ai: {
dev: {
rules: true // Enable AI assistant rules
}
}
})