Per-Project AI Connections
Since version 0.22 a project can use its own API key or its own AI provider.
Until now a Knecht instance had exactly one AI provider with one API key. Every run in every project used that key. For an agency, that doesn't always fit. Some clients pay for the AI costs of their project themselves. Others require a specific provider, for example Langdock in the EU. So since version 0.22, a project can have its own AI connection.
Inherited Field by Field

You'll find the "AI connection" panel in the project settings under "Advanced". As long as you don't change anything there, the project uses the AI provider from the global settings. Each field is inherited separately until you override it. That gives you full control:
- Your own key with the same provider. "Provider" stays on "Global default" and you only save a key. The project's costs then go to that key, while the models still follow the global settings.
- Your own provider. You pick a different provider and save its key. The project gets its own model list and its own models, and no longer inherits anything from the global settings.
What Uses It
Whenever Knecht uses AI and knows which project it is working on, it uses the project's AI connection instead of the global one. Right now, every AI feature in Knecht belongs to a project.
Global AI Features
This isn't built yet, but in the future there will be AI features that don't belong to any project, like building workflows. These features will need the global AI connection, even if every project has its own API key. So if you move all your projects to their own AI connections, keep this in mind.
API Key Validation
While adding AI connections per project, we also improved how API keys are validated. Before, Knecht didn't check the key at all. You only found out whether it worked once you actually used the AI.
Now you save the API key once, Knecht validates it, and the model list loads. Getting there was a bit tricky, though.
A Word About UX
We want every setting to save automatically, because it simply feels better. But that always raises the question of when to check whether a value is correct. Usually you validate while the user types. That doesn't work once a third-party API is involved: those requests take a while, and the delay feels strange.
Validating an API key means asking the provider whether it accepts the key, so it can't be instant. And only once the key is valid do we know which models the model picker can offer. A default model is required, so how do we make sure one is selected when we don't even know yet which models your provider has?
We solved this with a small save button next to the API key. When you save the key, Knecht validates it and then loads the available models. At that point the model dropdown would still be empty. So we defined a list of up to three preferred models for each provider, and the first one your provider offers gets preselected. That way a default model should always be saved right after you enter the API key.
