AI Config
OpenAI or Anthropic for auto-generating descriptions.
File: config/ai.config.ts
When AI is on, users get "Generate with AI" buttons in the submit flow — the LLM writes descriptions, suggests categories, and fills SEO metadata from a URL.
Two switches to flip
You need both ai: true in features.config.ts and a valid AI_API_KEY. Either missing → AI silently skips.
Supported providers
| Provider | Where to get a key |
|---|---|
| OpenAI | platform.openai.com → API keys |
| Anthropic | console.anthropic.com → API keys |


Setup
1. Turn on the feature flag
export const featuresConfig = {
// ...
ai: true,
};2. Add env vars
AI_PROVIDER=openai # or 'anthropic'
AI_MODEL=gpt-4o-mini # or 'claude-haiku-4-5' etc.
AI_API_KEY=sk-...Restart the dev server.
3. Verify
Go to /submit → fill in a project URL → click "Generate description with AI". If nothing happens, check the dev console / network tab for errors.
The config file
export const aiConfig = {
provider: (process.env.AI_PROVIDER as 'openai' | 'anthropic') || 'openai',
model: process.env.AI_MODEL || 'gpt-4o-mini',
apiKey: process.env.AI_API_KEY || '',
maxTokens: 1000,
temperature: 0.7,
};| Field | Default | What it does |
|---|---|---|
provider | openai | Provider. Must match your key. |
model | gpt-4o-mini | Model ID. See provider's docs for available models. |
apiKey | — | Pulled from AI_API_KEY. |
maxTokens | 1000 | Max response length. |
temperature | 0.7 | 0 = deterministic, 1 = creative. Good middle ground for descriptions. |
Recommended models
For directory descriptions (short, factual), cheap fast models win:
| Provider | Model | Input / Output cost |
|---|---|---|
| OpenAI | gpt-4o-mini | cheapest GPT-4-class |
| Anthropic | claude-haiku-4-5 | cheap and fast |
| OpenAI | gpt-4o | better quality, more expensive |
| Anthropic | claude-sonnet-4-5 | best quality Anthropic |
Start with the cheap one. Only upgrade if outputs are noticeably worse.
Cost control
- Each description generation is ~300-500 tokens → fractions of a cent per request.
- Rate-limit AI endpoints in
lib/rate-limit.tsto prevent abuse. - Consider caching generated descriptions by URL so re-submissions don't re-pay.
See also
- AI Features — where AI is used in the app