# AI plug issue with embeddings - v2

**URL:** <https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753>\
**Category:** Plugs and Libraries\
**Created:** [January 10, 2026, 5:57pm UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753 "2026-01-10T17:57:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![disoardi](https://community.silverbullet.md/user_avatar/community.silverbullet.md/disoardi/32/877_2.png) [@disoardi](https://community.silverbullet.md/u/disoardi)\
**Post date:** [January 10, 2026, 5:57pm UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/1 "2026-01-10T17:57:21Z")

</div>

I tried to set up embeddings with openAI as a proiveder. But, I run the connectivity test, it always tells me it doesn’t find the AI API key.

If I comment out the embeddings part, the connectivity test passes for the chat part.

Below is my setup (CONFIG page).

```json
local openai_key = "sk- ********************"

config.set { 
 ai = {
    -- Provider-level configuration
    providers = {
      openai = {
        apiKey = openai_key,
        -- Could also be something like: apiKey = config.get("ai.keys.OPENAI_API_KEY"),
        useProxy = false,
        preferredModels = {"gpt-4o", "gpt-4o-mini"}
      }
-- , ollama = {
-- baseUrl = "http://host.docker.internal:11434",
-- preferredModels = {"bge-m3"}
-- }
-- ,gemini = {
-- apiKey = "your-gemini-key",
-- preferredModels = {"gemini-2.0-flash"}
-- }
    },
    -- Default model to use (format: "provider:modelName")
    -- This is auto-selected on startup if no model is already selected on this client
    defaultTextModel = "openai:gpt-4o-mini",

    -- Embedding
    indexEmbeddings = true,
    --indexEmbeddingsExcludePages = {"my_passwords"},
    --indexEmbeddingsExcludeStrings = {" **user** :", "Daily Quote:"},
    embeddingModels = {
      -- Only the first model is currently used
      {
        name = "openaiemb",
        modelName = "text-embedding-3-small",
        provider = "openai",
 -- baseUrl = "http://localhost:11434",
        requireAuth = true,
        secretName = ai.keys,
        useProxy = false
      }
    },
    -- Chat settings
    chat = {
      -- Enable AI tools (read/write notes, search, etc.)
      enableTools = true,

      -- Parse [[wiki-links]] and include their content as context
      parseWikiLinks = true,

      -- Search embeddings for relevant context (requires indexEmbeddings)
      searchEmbeddings = true,
      bakeMessages = true,
      -- Default agent to use (by name)
      defaultAgent = nil,
      -- When using chat, the userInformation and userInstructions
      -- are included in the system prompt.
      userInformation = "I'm a italian IT Architect who likes taking notes.",
      userInstructions = "Please give short and concise responses. When providing code, do so in python unless requested otherwise with comment in line in english. All other word must be in italian. ",
      -- Dynamic context (Lua expression evaluated at chat time)
      customContext = [["Today is " .. os.date("%Y-%m-%d")]],

      -- Custom enrichment functions to run on messages
      customEnrichFunctions = {},

      -- Skip tool approval prompts (useful for benchmarks/automation)
      skipToolApproval = false

    }
  }
}

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)\
**Post date:** [January 10, 2026, 6:12pm UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/2 "2026-01-10T18:12:34Z")

</div>

Cc @justyns

---

<div class="post-metadata">

**Author:** ![justyns](https://community.silverbullet.md/user_avatar/community.silverbullet.md/justyns/32/132_2.png) [@justyns](https://community.silverbullet.md/u/justyns)\
**Post date:** [January 10, 2026, 11:38pm UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/3 "2026-01-10T23:38:14Z")

</div>

hey @disoardi ,

The new “providers” top level key is still pretty new so I haven’t integrated the embeddings or image model stuff into it yet. That means we’re kind of re-defining the provider just for the embbedding config.

I think what you’re missing is the **secretName** in your embedding config:

```auto
secretName = ai.keys

```

should be something like

```auto
secretName = "OPENAI_API_KEY"

```

and then you still need to also set:

```auto
config.set("ai.keys.OPENAI_API_KEY", "sk-xxxxxx")

```

Let me know if that works for you. I’ll probably try to improve that error message too so that it’s more obvious where it’s looking for the key

---

<div class="post-metadata">

**Author:** ![disoardi](https://community.silverbullet.md/user_avatar/community.silverbullet.md/disoardi/32/877_2.png) [@disoardi](https://community.silverbullet.md/u/disoardi)\
**Post date:** [January 11, 2026, 9:31pm UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/4 "2026-01-11T21:31:24Z")

</div>

> [@justyns](#):
>
> `secretName = "OPENAI_API_KEY"`

ok, if I set config.set(“ai.keys.OPENAI\_API\_KEY”, “sk-xxxxxx”) the embedding works but the chat stops working and tells me there is no api key for the chat

---

<div class="post-metadata">

**Author:** ![justyns](https://community.silverbullet.md/user_avatar/community.silverbullet.md/justyns/32/132_2.png) [@justyns](https://community.silverbullet.md/u/justyns)\
**Post date:** [January 12, 2026, 8:16am UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/5 "2026-01-12T08:16:51Z")

</div>

Just to confirm, you have both `secretName = "OPENAI_API_KEY"` in the embedding config and also still have `apiKey = openai_key` in your openai provider config? You might also need to refresh the page a couple times to make sure the new config is loaded.

e.g. something like this config:

```auto
local openai_key = "sk- ********************"
config.set("ai.keys.OPENAI_API_KEY", openai_key)

config.set { 
 ai = {
    providers = {
      openai = {
        apiKey = openai_key,
        useProxy = false,
        preferredModels = {"gpt-4o", "gpt-4o-mini"}
      }
    },
    defaultTextModel = "openai:gpt-4o-mini",
    indexEmbeddings = true,
    embeddingModels = {
      -- Only the first model is currently used
      {
        name = "openaiemb",
        modelName = "text-embedding-3-small",
        provider = "openai",
        requireAuth = true,
        secretName = "OPENAI_API_KEY",
        useProxy = false
      }
    },
  }
}

```

If so, there might be a bug somewhere. I’ll do some testing, but I’m also working on just getting rid of the separate embeddingModels option that would simplify the config a bit too.

---

<div class="post-metadata">

**Author:** ![disoardi](https://community.silverbullet.md/user_avatar/community.silverbullet.md/disoardi/32/877_2.png) [@disoardi](https://community.silverbullet.md/u/disoardi)\
**Post date:** [January 12, 2026, 10:45am UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/6 "2026-01-12T10:45:06Z")

</div>

> [@justyns](#):
>
> ```auto
> ultTextModel = "openai:gpt-4o-mini",
> indexEmbeddings = true,
> embeddingModels = {
> 
> ```

```auto
local openai_key = "sk-svcacct-***"

config.set("ai.keys.OPENAI_API_KEY", "sk-svcacct- ****")

config.set {
ai = {
    -- Provider-level configuration
    providers = {
      openai = {
        apiKey = openai_key,
        -- Could also be something like: apiKey = config.get("ai.keys.OPENAI_API_KEY"),
        useProxy = false,
        preferredModels = {"gpt-4o", "gpt-4o-mini"}
      }
-- , ollama = {
-- baseUrl = "http://host.docker.internal:11434",
-- preferredModels = {"bge-m3"}
-- }
-- ,gemini = {
-- apiKey = "your-gemini-key",
-- preferredModels = {"gemini-2.0-flash"}
-- }
    },
    -- Default model to use (format: "provider:modelName")
    -- This is auto-selected on startup if no model is already selected on this client
    defaultTextModel = "openai:gpt-4o-mini",

    -- Embedding
    indexEmbeddings = true,
    --indexEmbeddingsExcludePages = {"my_passwords"},
    --indexEmbeddingsExcludeStrings = {" **user** :", "Daily Quote:"},
    embeddingModels = {
      -- Only the first model is currently used
      {
        name = "openaiemb",
        modelName = "text-embedding-3-small",
        provider = "openai",
 -- baseUrl = "http://localhost:11434",
        requireAuth = true,
        secretName = ai.keys.OPENAI_API_KEY,
        useProxy = false
      }
    },
    -- Chat settings
    chat = {
      -- Enable AI tools (read/write notes, search, etc.)
      enableTools = true,

      -- Parse [[wiki-links]] and include their content as context
      parseWikiLinks = true,

      -- Search embeddings for relevant context (requires indexEmbeddings)
      searchEmbeddings = true,
      bakeMessages = true,
      -- Default agent to use (by name)
      defaultAgent = nil,
      -- When using chat, the userInformation and userInstructions
      -- are included in the system prompt.
      userInformation = "I'm a italian IT Architect who likes taking notes.",
      userInstructions = "Please give short and concise responses. When providing code, do so in python unless requested otherwise with comment in line in english. All other word must be in italian. ",
      -- Dynamic context (Lua expression evaluated at chat time)
      customContext = [["Today is " .. os.date("%Y-%m-%d")]],

      -- Custom enrichment functions to run on messages
      customEnrichFunctions = {},

      -- Skip tool approval prompts (useful for benchmarks/automation)
      skipToolApproval = false

    }
  }
}

```

With this configuration the embeddings works but gives an error on the chat (doing the Connectivity test it says it does not have the key API for chat).

If I comment out the embedding configuration, the Connectivity test is successful.

---

<div class="post-metadata">

**Author:** ![thepaperpilot](https://community.silverbullet.md/user_avatar/community.silverbullet.md/thepaperpilot/32/1557_2.png) [@thepaperpilot](https://community.silverbullet.md/u/thepaperpilot)\
**Post date:** [January 12, 2026, 5:58pm UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/7 "2026-01-12T17:58:26Z")

</div>

Just a head’s up, it looks like you used an actual openai key in that post? You’ll likely want to revoke that and get a new one.

---

<div class="post-metadata">

**Author:** ![disoardi](https://community.silverbullet.md/user_avatar/community.silverbullet.md/disoardi/32/877_2.png) [@disoardi](https://community.silverbullet.md/u/disoardi)\
**Post date:** [January 12, 2026, 7:57pm UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/8 "2026-01-12T19:57:56Z")

</div>

Sorry for the oversight.

I deleted the API keys from the openai platform.

Thank you for the notice and I confirm that we are all good people because no one took advantage of it.

---

<div class="post-metadata">

**Author:** ![justyns](https://community.silverbullet.md/user_avatar/community.silverbullet.md/justyns/32/132_2.png) [@justyns](https://community.silverbullet.md/u/justyns)\
**Post date:** [January 13, 2026, 9:57am UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/9 "2026-01-13T09:57:47Z")

</div>

> [@disoardi](#):
>
> ```auto
> secretName = ai.keys.OPENAI_API_KEY,
> 
> ```

This part should be:

```auto
secretName = "OPENAI_API_KEY"

```

But! I just released [version 0.6.4](https://github.com/justyns/silverbullet-ai/releases/tag/0.6.4) - can you update to it? And then you no longer need `embeddingModels` at all. Just set `defaultEmbeddingModel` like this:

```lua
config.set {
  ai = {
    providers = {
      openai = {
        apiKey = "your-openai-key-here"
      }
    },
    defaultTextModel = "openai:gpt-4o",
    defaultEmbeddingModel = "openai:text-embedding-3-small",
    indexEmbeddings = true
  }
}

```

---

<div class="post-metadata">

**Author:** ![disoardi](https://community.silverbullet.md/user_avatar/community.silverbullet.md/disoardi/32/877_2.png) [@disoardi](https://community.silverbullet.md/u/disoardi)\
**Post date:** [January 13, 2026, 10:37am UTC](https://community.silverbullet.md/t/ai-plug-issue-with-embeddings-v2/3753/10 "2026-01-13T10:37:39Z")

</div>

perfect, now it works. you’re a Great
