---
title: "ai.credential-put@2 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/ai.credential-put"
updated: null
---

# ai.credential-put@2 · OpenVibe.Services

HTML: [ai.credential-put@2 · OpenVibe.Services](https://openvibe.services/docs/contracts/ai.credential-put)

# AiCredentialPutV2 `ai.credential-put@2`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/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`](/docs/contracts/ai.credential-put.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). | - `one of "anthropic", "openai", "deepseek", "minimax", "openrouter", "custom", "link"` |
| `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. | - `minLength 8`<br>- `maxLength 400` |
| `api_key` | string |  | The ai.credential-put@1 name for \`key\`, still accepted. When both are sent, \`key\` wins. | - `minLength 8`<br>- `maxLength 400` |
| `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. | - `pattern ^https://[^\s/?#@]+(/[^\s?#]*)?$`<br>- `maxLength 300` |
| `machine` | string |  | provider link: the person's own machine (openvibe.link/machines) whose OpenVibe Link runs the model, or \`any\` of their own. | - `pattern ^(dev_[0-9A-HJKMNP-TV-Z]{26}\|any)$` |
| `models` | object |  | Model per role on this provider; \`chat\` is the default for the others. | - `no other fields` |
| `models.chat` | string |  |  | - `minLength 1`<br>- `maxLength 120` |
| `models.vision` | string |  |  | - `minLength 1`<br>- `maxLength 120` |
| `models.director` | string |  |  | - `minLength 1`<br>- `maxLength 120` |
| `models.summary` | string |  |  | - `minLength 1`<br>- `maxLength 120` |
| `models.legacy` | string |  |  | - `minLength 1`<br>- `maxLength 120` |
| `budget_usd_per_day` | number |  | The person's own daily cap on estimated spend with this provider's key; 0 or absent = no cap. | - `minimum 0`<br>- `maximum 1000` |

## 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 }] }
~~~~
