Logotipo Hedhog

Get Hedhog updates in your inbox

New releases, fresh recipes, and breaking changes — no spam.

AI Providers

Hedhog's built-in AI chat (AiService, POST /ai/chat) talks directly to OpenAI and Google Gemini — these are the only two providers the core module supports today.

Status: ✅ Implemented — OpenAI and Gemini both work through /ai/chat.

Core AI chat routing a request to either OpenAI or Google Gemini based on the configured Integration Profile

Quick Setup

  1. Create an Integration Profile (type AI, provider openai or gemini) with an api_key at Settings → Integration Profiles
  2. Go to Settings → Configurations → General, find AI Configuration, and point ai-openai-profile-id and/or ai-gemini-profile-id at that profile
  3. Call POST /ai/chat with { message, provider } (provider defaults to openai) and confirm you get a real completion back

How It Works

  1. Create an Integration Profile of type AI, provider openai or gemini, with an api_key in its config
  2. Go to Settings → Configurations → General, find the AI Configuration section, and set the matching field — ai-openai-profile-id (OpenAI Profile) or ai-gemini-profile-id (Gemini Profile) — to that profile
  3. AiService reads whichever profile is configured for the provider the caller requests (data.provider defaults to openai) and calls the corresponding API directly

If neither ai-openai-profile-id nor ai-gemini-profile-id is set, the server logs a warning on boot ("No AI profiles configured") but still starts — calls to /ai/chat simply fail until you configure at least one.

Default Models

data.model is optional on POST /ai/chat — if you leave it out, AiService falls back to:

ProviderDefault model if model is left empty
openaigpt-4o-mini
geminigemini-1.5-flash

Supported Providers

Providerintegration_provider slugModel family
OpenAIopenaiGPT-4o, GPT-4, GPT-3.5 Turbo
Google GeminigeminiGemini 2.0 Flash, Gemini 1.5 Pro/Flash

OpenAI

Console: platform.openai.com

  1. Go to API keys and create a new secret key
  2. Optionally create a project and restrict the key to it, and set usage limits under Settings → Limits so a bug somewhere can't run away with your budget
Config fieldDescription
api_keyOpenAI API key (sk-…)
organizationOptional — organization ID, only needed for multi-org accounts

Google Gemini

Console: aistudio.google.com or console.cloud.google.com

  1. In AI Studio, click Get API key for the fastest path, or in GCP enable the Generative Language API and create credentials if you need the key tied to a billing project
Config fieldDescription
api_keyGemini API key

Cost Considerations

Both providers charge per token (input + output) directly to your account — Hedhog adds no markup. Set a model per use case rather than defaulting everything to the most expensive option:

  • High quality / complex tasks: gpt-4o, gemini-1.5-pro
  • Balanced / default: gpt-4o-mini, gemini-1.5-flash
  • High volume / simple tasks: gpt-3.5-turbo, gemini-2.0-flash

Verify It Worked

  • Call /ai/chat with provider: "openai" and confirm you get a real completion back, not a 400
  • Call it again with provider: "gemini" and confirm the same

Troubleshooting

SymptomLikely cause
"No AI profiles configured" warning on bootNeither ai-openai-profile-id nor ai-gemini-profile-id is set — harmless until something calls /ai/chat
400 from /ai/chatThe profile for the requested provider isn't set, doesn't exist, or has no api_key in its config
Response uses a different model than expectedYou left model empty — Hedhog applied the per-provider default instead (see table above)