Firefox AI sidebar is just an additional tab that opens some AI provider's website with a prompt passed via the q=PROMPT URL parameter.
The prompt is built from a prefix that gives the AI relevant context and a command prompt that is appended afterwards.
The command prompt is either entered by the user via the UI or predefined depending on the selected menu item (e.g. 'summarize' -> some summarization prompt).
All of this can be configured in about:config.
Firefox comes preconfigured with a selection of major providers.
You can also configure a local or custom provider.
First set browser.ml.chat.hideLocalhost to false.