Documentation menu

AI features

Two optional assistants in the app. Both are suggestions only: they fill in the form, a small "AI-generated, please check" note appears, and the user can change everything before sending.

Feature Who What it does
Write it for me Customer, on Post a job From up to 3 photos and rough notes, suggests a title, a description and the category
Suggest a price and message Provider, on the quote form Suggests a price range (the form gets the middle), a duration and a short message, based on the job, the provider's own service prices and their last 20 quotes in that category

Without an AI key, both buttons are hidden (features.ai in GET /config is false).

1. Choose a provider

In Admin → Settings → Integrations → AI, pick a provider, paste its API key and save. Test sends a tiny request through the same code the features use.

Provider Default model (when Model is empty) Get a key
OpenAI gpt-4.1-mini platform.openai.com
Anthropic (Claude) claude-opus-5-5 console.anthropic.com
Google Gemini gemini-2.5-flash aistudio.google.com

You can enter any model name the provider offers, as long as it:

  • accepts images (the job draft sends photos), and
  • supports structured JSON output: OpenAI json_schema, Anthropic output_config.format, Gemini responseSchema.

The API calls each provider over plain HTTPS. No SDKs are needed, and the key never leaves the server.

2. Cost and limits

You pay the provider per token. Most of the input is the photos plus the category list, and answers are short.

  • Daily limit per user: Admin → Settings → Business → AI requests per user per day (default 20, 0 = no limit). Over the limit, the app shows "You have used all your AI suggestions for today".
  • Usage: the admin dashboard has an AI assistants card showing requests, failed calls, tokens in and out, and average response time for the selected period.
  • Every call is logged in the ai_usage table: user, feature, provider, model, tokens, latency and outcome. No prompt or answer text is stored.
  • If an answer doesn't match the expected JSON, the API asks once more and logs both calls. If it fails again, the user sees "We couldn't get a suggestion right now".
  • Pricier models write slightly better text but cost more per request. Try a smaller model from your provider first and compare on a few real jobs.

3. Edit the prompts

The prompts are plain Markdown files:

  • backend/resources/prompts/job-draft.md
  • backend/resources/prompts/quote-helper.md

Everything above the === USER === line is the instruction (system prompt). Everything below it is the message with the job's data. {{placeholders}} are filled in by the API:

File Placeholders
job-draft.md {{locale}}, {{categories}} (one id: Parent > Name per line), {{text}}, {{photo_count}}
quote-helper.md {{locale}}, {{currency}}, {{services}}, {{past_quotes}}, {{category}}, {{title}}, {{description}}, {{budget}}

Change the wording, tone or rules freely. Keep the placeholders and the answer fields the code expects (title, description, category_id, confidence / min, max, duration_minutes, message_draft). Answers are written in the language the app is using.

Privacy

Only the job is sent: the photos the user attached, their notes, the category names and, for quotes, the provider's own prices and past quote amounts. Names, emails, phone numbers and exact addresses are never sent. Mention AI processing in your privacy policy, and check that your provider's data terms (for example, zero data retention or no training on API data) suit your market.

API

  • POST /api/v1/ai/job-draft: {media_ids?: int[≤3], text?: string} → {title, description, category_id|null, confidence}
  • POST /api/v1/ai/quote-helper (provider): {job_request_id} → {min, max, currency, duration_minutes, message_draft}. Amounts are in minor units.

Errors: AI_UNAVAILABLE (503, no key), AI_LIMIT_REACHED (429), AI_FAILED (502, provider error or invalid answer), MEDIA_INVALID (422, not the user's own images).