AI providers (bring your own key)

Lucida's AI features (the assistant, research, scouts, session summaries, Replay Vision, experiment drafts, workflow AI steps, semantic search) run on your...

Embed
Preview of the card
<a href="https://lucidace.com/help/ai-providers"><img src="https://lucidace.com/help/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/2f4b888b-c4e6-488b-81bd-6e838fb12d2e/pages/6d931a71-af0e-4e0b-b80b-06c7ecabfca5/social-card.svg?v=3e7ae33eec8b" alt="AI providers (bring your own key)" width="600" height="315"></a>

Lucida's AI features (the assistant, research, scouts, session summaries, Replay Vision, experiment drafts, workflow AI steps, semantic search) run on your own AI provider account. Nothing is sent to a model until an organization admin connects a provider in Settings -> Organization -> AI providers. Until then every AI endpoint answers 409 with the problem type https://lucidace.com/help/problems#ai-provider-required and the message "connect an AI provider in Settings -> AI" (never a 500).

How it works

  • An organization connects one or more providers. A project can add its own providers and defaults (Project settings -> AI providers) that override the organization's for that project only.

  • For each purpose you choose which provider and model serves it, with sensible defaults per provider:

    • Chat and analysis: the assistant, research, scouts, deep analysis.

    • Fast and cheap: bulk summaries and classification.

    • Embeddings: semantic search over knowledge sources, replay observations, embedText() in SQL and inbox clustering. Without an embedding provider a built-in keyword-hashing fallback is used.

  • The first provider you connect is routed to every purpose it supports automatically.

  • The per-organization controls keep working in front of every provider: the AI on/off switch, the project kill switch, the monthly USD cap, the token budget, PII scrubbing and the audit log (prompt hashes and token counts, never prompts or keys).

Supported providers

Provider

What you need

Chat

Embeddings

Model list

Anthropic

API key

yes

no

yes

OpenAI

API key

yes

yes

yes

Azure OpenAI

API key, resource endpoint (https://<name>.openai.azure.com), deployment names as models

yes

yes

yes

Google Gemini (AI Studio)

API key

yes

yes

yes

Google Vertex AI

service-account JSON, project id, location

yes

yes

no

AWS Bedrock

Bedrock API key or IAM access key id + secret (+ session token), region

yes (Converse API)

yes (Titan, Cohere)

yes

Mistral

API key

yes

yes

yes

Cohere

API key

yes

yes

yes

Groq, xAI (Grok), DeepSeek, Perplexity, OpenRouter

API key

yes

no

most

Together, Fireworks

API key

yes

yes

yes

Custom

any OpenAI-compatible endpoint: base URL, optional key, optional headers, model names

yes

yes

if /models exists

Setup notes

  • Anthropic / OpenAI / Mistral / Cohere / Groq / xAI / DeepSeek / Together / Fireworks / Perplexity / OpenRouter: create an API key in the provider's console, paste it, press Connect provider, then Test connection.

  • Azure OpenAI: set Base URL to your resource endpoint. Azure addresses models by deployment, so type your deployment names into the chat, fast and embedding fields (there are no defaults). The API version defaults to 2024-10-21.

  • Gemini (AI Studio): a key from Google AI Studio. The key travels in a request header, never in a URL.

  • Vertex AI: paste the whole service-account JSON as the key (role Vertex AI User), plus the project id and a location such as us-central1. Lucida mints short-lived access tokens itself.

  • Bedrock: choose a region where your models are enabled. Use a Bedrock API key, or an IAM user's access key id and secret. Models are Converse-capable model or inference-profile ids, for example us.anthropic.claude-sonnet-4-5-20250929-v1:0. Requests are signed with AWS Signature V4.

  • Custom (in-house models): for vLLM, Ollama, LM Studio, TGI or a LiteLLM gateway set the Base URL to the server's OpenAI-compatible root (for example http://ollama.internal:11434/v1), give the chat model name your server serves, and add any gateway headers (Name: value per line; stored encrypted). Custom endpoints are not priced in USD, so they do not count against the monthly cap. The model needs tool-calling support for the assistant and scouts.

Self-hosters: private network endpoints

Outbound provider calls go through the same SSRF guard as connectors, so private addresses are refused by default. To reach an in-house model on your network, allow its range with LC_CONNECTORS_ALLOW_CIDRS (for example 10.0.0.0/8) or route through LC_EGRESS_PROXY.

Data handling

  • Keys: shown once, envelope-encrypted with the same master key ring as connector credentials (LC_MASTER_KEY), stored in Postgres (ai_providers.sealed), never returned by the API (only a masked hint such as ••••4321 and header names), never written to logs, and scrubbed from any error text. The edit form never prefills a key; leaving a secret field empty keeps the stored one. Without LC_MASTER_KEY the API refuses to store keys.

  • What leaves Lucida: the prompt for the call (instructions, your question, the query results or masked session transcripts the feature needs) goes to the provider you chose, under your agreement with that provider. Person properties are excluded unless LC_AI_INCLUDE_PERSON_PROPERTIES=true; replay input values are masked as always.

  • In-context drafts (all suggestions; nothing is saved until you save the form they fill):

    • Summarize account on a group profile sends numbered facts only: activity counts, the most frequent recent event names, usage-metric values, health-score rows, journey step status and support-ticket counts by status and priority (never ticket text, person ids or emails; group properties are masked). The latest summary is cached in ai_account_summaries and is shown again only after lc-ai re-reads the group with your credentials.

    • Draft with AI in the metric-tree editor sends the north-star metric, saved metric names and the event and property catalog; every metric, event and property the model names is checked and unknown ones are dropped (listed in the editor). New metrics are created, marked ai_generated, when you save the tree.

    • Draft with AI in a replay's Create issue dialog sends the masked transcript and your description as a hint.

    • Suggest rules in path cleaning sends URL templates (ids, UUIDs and slugs already replaced) with up to five example paths; clustering and regex testing happen in Lucida, the model only names the groups.

  • Embeddings: texts embedded for search (document chunks, observation summaries, report titles) go to your embedding provider. Vectors are stored in Lucida's Postgres. After you switch embedding provider, refresh your knowledge sources so they are embedded again (vectors of a different size are ignored, and keyword search keeps working in between).

  • Access: only organization owners and admins can read or change provider settings. Anyone else gets 404 (not a member) or 403 (a member without the admin role).

  • Streaming: model calls are request/response; replies are not streamed token by token from the provider (the assistant still streams its steps and answer to the browser).

API

OpenAPI for these routes is served by lc-ai at /v1/openapi-ai.json.

GET    /v1/orgs/{org_id}/ai-providers-catalog      supported providers, fields, default models
GET    /v1/orgs/{org_id}/ai-providers              ?limit=&cursor=  ->  {data, next_cursor}
POST   /v1/orgs/{org_id}/ai-providers              {kind, name, api_key, base_url, models:{chat,fast,embed}, ...}
GET    /v1/orgs/{org_id}/ai-providers/{id}
PATCH  /v1/orgs/{org_id}/ai-providers/{id}        omitted secrets are kept
DELETE /v1/orgs/{org_id}/ai-providers/{id}
POST   /v1/orgs/{org_id}/ai-providers/{id}/test    {ok, error?, embeddings}   a tiny live call; never echoes the key
GET    /v1/orgs/{org_id}/ai-providers/{id}/models  {data: [...], supported}
GET    /v1/orgs/{org_id}/ai-routes                 {data: {chat|fast|embed: {provider_id, model}}}
PUT    /v1/orgs/{org_id}/ai-routes                 set or clear (empty provider_id) the default per purpose

The same routes exist per project under /v1/orgs/{org_id}/projects/{project_id}/... for the project override. Errors are RFC 9457 problem+json.

Instance-wide default (self-hosting only)

Operators can set a fallback used when an organization has not connected a provider. It is optional; without it, organizations must bring their own key.

Variable

Meaning

ANTHROPIC_API_KEY

Anthropic as the instance default (the original behavior)

LC_AI_DEFAULT_PROVIDER

a provider kind from the catalog (openai, gemini, custom, ...)

LC_AI_DEFAULT_API_KEY, LC_AI_DEFAULT_BASE_URL

its key and endpoint

LC_AI_DEFAULT_CHAT_MODEL, _FAST_MODEL, _EMBED_MODEL

model per purpose

LC_AI_DEFAULT_REGION, _PROJECT, _API_VERSION

Bedrock/Vertex/Azure settings

AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN

Bedrock credentials

Resolution order for each AI call: the project's provider, then the organization's, then the legacy per-organization Anthropic key (the older Settings -> AI key field), then this instance default. LC_AI_SERVICE_TOKEN (shared by lc-api, lc-ai and lc-workflows) is still required to enforce the AI switches and the spend cap; without it AI is refused.

Updated