Setup#
Installing kinetis/vector-ai, then configuring its providers,
settings and keys.
Installation#
The package needs ext-sodium.
Install the package and its tables:
composer require kinetis/vector-ai vendor/bin/kinetis vector-ai:install # the credentials, usage, approvals and rewrites tables vendor/bin/kinetis migrate
vector-ai:installpublishes the migrations of four tables,vector_ai_credentials,vector_ai_usage,vector_ai_approvalsandvector_ai_rewrites, tomigrations/, or tomigrations/<name>/with--connection=<name>, likevector:install. Put them on Vector’s own connection (VECTOR_DB_CONNECTION); the command warns when they differ.Restart the workers. The AI UI ships in
@kinetis/vector-uiin both modes (Deployment); a hosted admin gets it from the bundlevector:install-uiinstalls, so rerun that after upgradingkinetis/vector. It shows once the API publishescapabilities.ai.Standalone only: add
Retry-Afterto yourCorsMiddleware’sexposedHeaders, or the admin, on another origin, cannot say when a spent daily budget renews.Schedule
vector-ai:approvals:prune(Bulk rewrite retention): nothing else deletes stale proposals or a bulk rewrite’s rows.Configure a provider (Operator configuration).
Against a backend without kinetis/vector-ai, the admin shows no AI
feature and sends no AI request.
Operator configuration#
The operator lists the providers and configures each under its own keys, read once at boot. A value that cannot work stops the boot, naming its key.
VECTOR_AI_PROVIDERS=openai,bedrock # names: 1-40 of a-z, 0-9 and -, and not default
VECTOR_AI_<NAME>_TYPE=openai|anthropic|openai-like|ollama|bedrock|fake
VECTOR_AI_<NAME>_BASE_URL=https://... # openai-like and ollama
VECTOR_AI_<NAME>_KEY=... # optional; else an administrator stores one
VECTOR_AI_<NAME>_MODELS=a,b # the allow-list; empty admits any
VECTOR_AI_<NAME>_REGION=eu-central-1 # bedrock
VECTOR_AI_KEY=base64:... # 32 bytes; without it, keys cannot be stored
VECTOR_AI_TIMEOUT=90 # seconds per call
VECTOR_AI_MAX_RESPONSE_BYTES=4194304
VECTOR_AI_MAX_OUTPUT_TOKENS=2048
<NAME> is the provider’s name in upper case, with a dash as an
underscore: local-llm’s type is VECTOR_AI_LOCAL_LLM_TYPE. The keys
are scoped like a named connection’s (Config::scopedKey()).
Type |
Talks to |
Key |
|---|---|---|
|
|
required |
|
|
required |
|
an OpenAI-compatible server at |
optional |
|
an Ollama server at |
none |
|
Amazon Bedrock in |
none |
|
nothing: replays scripted replies, for tests and demos (Testing) |
none |
The boot stops on an unknown or missing type; a BASE_URL that is not
https:// where http:// is not allowed, or that holds credentials; a
key for a type that takes none; a Bedrock provider without a region; and
a malformed VECTOR_AI_KEY.
Each worker builds one HTTP client per provider origin, pinned to its
base URL and bounded by VECTOR_AI_TIMEOUT and
VECTOR_AI_MAX_RESPONSE_BYTES, and one signing client per Bedrock
region and deadline: VECTOR_AI_TIMEOUT, and each feature’s shorter
one. Parallel tool calls are never turned on: they would fork the
worker.
The AI settings#
The AI assistant group on the Settings page holds what an
administrator decides, under the access policy’s canConfigure()
(The access policy).
Setting |
Default |
|
|---|---|---|
Plain-language filters, Assistant, Writing help |
on |
each feature’s switch |
Assistant may propose changes ( |
off |
each proposal waits for a person (Changes the assistant proposes) |
Provider and model per feature |
empty |
a provider |
Daily token budget per user |
200000 |
input and output tokens a day (UTC); 0 turns AI off |
Tool calls per assistant run ( |
8 |
1 to 20; a proposal counts as one |
Minutes a proposed change waits for approval ( |
15 |
1 to 120 |
Record data sent to the model |
every field |
or only fields marked to send (Data sent to the model) |
Saving refuses an unconfigured provider, and a model off its provider’s allow-list. API keys are not settings, which are stored in plain text and served to the page; they have their own store (Provider keys).
Provider keys#
An openai or anthropic provider needs an API key, and an
openai-like provider may take one; bedrock, ollama and fake
take none. Each provider gets its key one of two ways.
The operator sets it in the environment#
When whoever deploys the server holds the key, put it beside the provider’s other settings:
VECTOR_AI_PROVIDERS=openai
VECTOR_AI_OPENAI_TYPE=openai
VECTOR_AI_OPENAI_KEY=sk-...
It is read at boot, and its status reports it as managed by the environment: an administrator cannot replace or remove it.
An administrator enters it in the admin#
When the key belongs to whoever runs the admin, it is stored encrypted
with VECTOR_AI_KEY, an environment secret, so a database copy alone
reveals no key.
Generate
VECTOR_AI_KEYonce:php -r 'echo "base64:", base64_encode(random_bytes(32)), PHP_EOL;'Add it to the environment, and list the provider without a key:
VECTOR_AI_KEY=base64:... VECTOR_AI_PROVIDERS=openai VECTOR_AI_OPENAI_TYPE=openai
Restart the application.
An administrator enters the key in the Settings page’s AI group.
Without VECTOR_AI_KEY, saving a key answers 403, “Set VECTOR_AI_KEY
to store provider keys”. Keep VECTOR_AI_KEY with your other secrets
and never change it: a key stored under one does not open under another,
so after a change every stored key is reported as sealed with another
key; re-enter it. With VECTOR_AI_KEY removed, stored keys are
reported as present but unusable until it is set back.
How a stored key is kept#
It is sealed with libsodium (AEAD XChaCha20-Poly1305), with a fresh random nonce per write and the provider’s name as additional data, so it does not open in another provider’s row.
It is stored in
vector_ai_credentialsand never shown again, by any endpoint, page, error or log line.Each row records the id of the key that sealed it (the first 8 hex characters of its SHA-256), so a key sealed under another
VECTOR_AI_KEYis recognized rather than misread.Storing and removing one are audited (Audit trail and impersonation) as resource
vector-ai:credentials, the provider’s name, the eventsetordelete, and the actor (and impersonator), never the key. The Audit page shows these entries only to whoever may configure AI (canConfigure()).
The key endpoints#
These routes, all behind the access policy’s canConfigure(), manage
stored keys:
Route |
Does |
|---|---|
|
Lists each configured provider’s key status (below). Never the key. |
|
Seals and stores |
|
Removes the stored key. |
Each status carries set, managedBy (environment, admin, or
null for a type that takes no key), storable, for a stored key
updatedAt and updatedBy, and for an unusable one problem. Beside
it, sealedWithAnotherKey is true when another VECTOR_AI_KEY sealed
the key, and absent when the server has no VECTOR_AI_KEY (storable
is then false).