Connect your own AI provider
Use your own OpenAI or OpenRouter key to power Ask AI answers on your published docs and AI assist in the editor, choose a model, and keep the search index ready.
- 4 min read
- Updated
On this page
Smart AI connects your site to an AI provider so readers can use Ask AI on your published docs, and writers can use AI assist in the editor. You can bring your own provider key, so usage is billed to your own provider account, or use the provider your Nibleaf host already set up.
An API key is a secret password that lets Nibleaf use your provider account. Treat it like a password.
- You need to be the site's Owner or an Admin.
- Publish your site at least once. The assistant answers only from published pages.
- To bring your own key, create an API key in your OpenAI or OpenRouter account. Make sure the account has credit and access to the model you want.
- Open Settings → Smart AI.
- On the OpenAI or OpenRouter card, paste your key into API key.
- Select Verify key and load models. Nibleaf checks the key with your provider without generating an answer.
- Choose an Answer model, then select Save changes.
- Select Enable with this provider.
The card now shows Selected for this workspace, and the status at the top shows AI answers enabled. Saving a key on its own does not turn AI on. You always choose Enable with this provider yourself.
The settings apply to this site only.
If your Nibleaf host set up a provider, the page shows an Instance-managed provider card. Select Enable with this provider on that card to use it instead of your own key. When you select your own provider, Nibleaf uses only your key.
The Published search index card shows whether Ask AI can read your latest published version:
- "The published index is ready" means answers can use your published pages.
- "The index is not ready yet" means Nibleaf is still reading your pages, or the last attempt failed. Select Build or refresh index.
- "Publish your documentation first" means the site has no published version yet.
Nibleaf rebuilds the index after each publish. Use Refresh to update the status, and Open published documentation to try Ask AI yourself.
- Replace a key: paste the new key, tick I want to replace this workspace's stored key., select Verify key and load models, then Save changes. To keep the stored key, leave API key empty.
- Turn off AI: select Turn off workspace AI. Ask AI disappears from your site, ordinary search keeps working, and your stored key is kept so you can turn it back on later.
Keys are encrypted on the server and never shown again in the browser. Your provider bills you for the answers your readers request. Nibleaf's daily answer and request limits still apply, so a busy day cannot run up unlimited costs. Ask AI only reads published pages that the reader is allowed to see.
Signing in with an OpenAI or ChatGPT account is not available yet. Use an OpenAI API key instead.
The editor's AI assist uses your site's selected connection when it is usable: your draft and instructions are sent to that provider to write the text. If the site has no usable connection, AI assist uses the provider from your Nibleaf host, when one is set up. Selecting Turn off workspace AI also turns off AI assist.
Drafting has a daily limit shared by the workspace, including requests made with your own key. If you reach it, wait for it to reset.
| What you see | What to do |
|---|---|
| The provider refused these credentials. | Check that you copied the whole key, that it is active, and that your provider account has credit. |
| No compatible answer models were listed for this connection. | Check which models your provider account can use. |
| These settings changed in another session. | Someone else changed Smart AI. Refresh the page, then try again. |
| Indexing is already running. | Wait, then select Refresh. |
| Your administrator needs to configure credential encryption. | Keys can't be saved on this server yet. Ask your Nibleaf host. |
| Semantic search infrastructure is not configured. | AI answers are not set up on this server. Self-hosters: see Operate hybrid search and grounded answers. |