AI — providers and generation

Attach a provider key

Scope: settings:write. Currently supported provider: openai, anthropic, aitunnel, hydraai, ldmai. Key is encrypted server-side immediately.

curl -s -X POST "https://api.live-direct-marketing.online/api/provider-configs" \
  -H "Authorization: Bearer $LDM_KEY" -H "Content-Type: application/json" \
  -d '{"provider":"openai","apiKey":"sk-...","model":"gpt-4o-mini"}'

List configured providers

Scope: ai:read. Returns providers with hasKey: true|false (the stored key itself never leaves the server).

curl -s "https://api.live-direct-marketing.online/api/ai/providers" \
  -H "Authorization: Bearer $LDM_KEY"

Generate copy

Scope: ai:write. Uses the default routed provider unless overridden.

curl -s -X POST "https://api.live-direct-marketing.online/api/ai/generate" \
  -H "Authorization: Bearer $LDM_KEY" -H "Content-Type: application/json" \
  -d '{
    "prompt":"Write a 2-sentence reply that thanks the prospect and books a 15-min call",
    "context":{"company":"Acme","industry":"SaaS"}
  }'