AiCredentialPutV2 ai.credential-put@2
Generated at from
openvibe-contracts v0.454.0 and
openvibe-sdk v0.193.0.
- Version
- 2.0.0
- Owner
- ai
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/ai/credential-put.v2.json
ai.credential-put@2 (OpenVibe.AI; Codes C3): one person's own provider key per provider, stored by the service that holds their consent, PUT /api/v1/credentials/{subject}/{provider} with capability ai.credential.manage. It adds the provider dimension to ai.credential-put@1: a person may keep an Anthropic, OpenAI, DeepSeek, MiniMax, OpenRouter or custom key side by side, each with its own daily budget, and the route without a provider still stores the default one. `key` is the secret (v1's `api_key` stays accepted); `base_url` names the endpoint of a custom provider and is optional elsewhere. OpenVibe.AI encrypts the key at rest, bound to its owner, subject and provider, and never returns it. Provider `node` is unchanged: the person's own machine, named by `machine`, with no key.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
provider | enum | yes | anthropic = Anthropic's Messages API; openai = any OpenAI-compatible endpoint; deepseek, minimax and openrouter = those providers; custom = the endpoint in base_url (a URL that speaks the OpenAI or the Anthropic format, by the route it is used on); node = the person's own machine (no key, no base_url, no cost). |
|
key | string | The provider key (ai.credential-put@2's name for v1's api_key). Required the first time, and whenever provider or base_url changes (a key is never sent to a new endpoint without being entered again); otherwise the stored key is kept, and it is never returned. |
| |
api_key | string | The ai.credential-put@1 name for `key`, still accepted. When both are sent, `key` wins. |
| |
base_url | string | The endpoint of a custom provider (required for it): https, no credentials, query or fragment. OpenVibe.AI connects only to public addresses. |
| |
machine | string | provider link: the person's own machine (openvibe.link/machines) whose OpenVibe Link runs the model, or `any` of their own. |
| |
models | object | Model per role on this provider; `chat` is the default for the others. |
| |
models.chat | string |
| ||
models.vision | string |
| ||
models.director | string |
| ||
models.summary | string |
| ||
models.legacy | string |
| ||
budget_usd_per_day | number | The person's own daily cap on estimated spend with this provider's key; 0 or absent = no cap. |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: custom-base
{
"provider": "custom",
"key": "sk-custom-EXAMPLEEXAMPLEEXAMPLE",
"base_url": "https://llm.example.com/anthropic",
"budget_usd_per_day": 1
}Valid: deepseek-key
{
"provider": "deepseek",
"key": "sk-deepseek-EXAMPLEEXAMPLEEXAMPLE",
"models": {
"chat": "deepseek-chat"
},
"budget_usd_per_day": 3
}Valid: link-any
{
"provider": "link",
"machine": "any",
"models": {
"chat": "llama3.1:8b"
}
}Valid: link
{
"provider": "link",
"machine": "dev_01M5YGM39VC2RRGDQPRD6D4SHD",
"models": {
"chat": "llama3.1:8b"
}
}Valid: minimax-key
{
"provider": "minimax",
"key": "sk-minimax-EXAMPLEEXAMPLEEXAMPLE",
"models": {
"chat": "MiniMax-M2"
}
}Valid: models-only
{
"provider": "openai",
"base_url": "https://openrouter.ai/api/v1",
"models": {
"chat": "gpt-4o-mini"
}
}Valid: openrouter
{
"provider": "openai",
"base_url": "https://openrouter.ai/api/v1",
"api_key": "sk-or-v1-EXAMPLEEXAMPLEEXAMPLE",
"models": {
"chat": "gpt-4o-mini"
},
"budget_usd_per_day": 2
}Rejected: custom-http-base
{
"provider": "custom",
"key": "sk-custom-EXAMPLEEXAMPLE",
"base_url": "http://llm.example.com/anthropic"
}Rejected: custom-without-base
{
"provider": "custom",
"key": "sk-custom-EXAMPLEEXAMPLE"
}Rejected: http-base
{
"provider": "openai",
"base_url": "http://10.0.0.1/v1",
"api_key": "sk-EXAMPLEEXAMPLE"
}Rejected: link-machine-anyone
{
"provider": "link",
"machine": "anyone",
"models": {
"chat": "llama3.1:8b"
}
}Rejected: link-with-key
{
"provider": "link",
"machine": "dev_01M5YGM39VC2RRGDQPRD6D4SHD",
"api_key": "sk-not-for-a-machine"
}Rejected: link-without-machine
{
"provider": "link",
"models": {
"chat": "llama3.1:8b"
}
}Rejected: unknown-provider
{
"provider": "groq",
"key": "sk-groq-EXAMPLEEXAMPLE"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('ai.credential-put@2', value); // { valid, errors: [{ path, message }] }