Register a model provider
const url = 'https://example.com/v1/providers';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"metadata":{"id":"example","region":"example","models":[{"name":"example","contextWindow":1,"features":["structured-output"],"cost":{"promptUsdPer1kTokens":1,"completionUsdPer1kTokens":1},"p95LatencyMs":1,"maxOutputTokens":1,"sampling":true,"thinking":{"mode":"adaptive","lowest":"example","levels":["minimal"],"default":"lowest"},"description":"example"}],"defaultModel":"example","attributes":["example"],"description":"example","capabilityKind":"example","fallback":true,"labels":{"additionalProperty":"example"}},"adapter_id":"example","secret_ref":{"envName":"example","name":"example"},"adapter_config":{"additionalProperty":"example"},"send_traceparent":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/providers \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "metadata": { "id": "example", "region": "example", "models": [ { "name": "example", "contextWindow": 1, "features": [ "structured-output" ], "cost": { "promptUsdPer1kTokens": 1, "completionUsdPer1kTokens": 1 }, "p95LatencyMs": 1, "maxOutputTokens": 1, "sampling": true, "thinking": { "mode": "adaptive", "lowest": "example", "levels": [ "minimal" ], "default": "lowest" }, "description": "example" } ], "defaultModel": "example", "attributes": [ "example" ], "description": "example", "capabilityKind": "example", "fallback": true, "labels": { "additionalProperty": "example" } }, "adapter_id": "example", "secret_ref": { "envName": "example", "name": "example" }, "adapter_config": { "additionalProperty": "example" }, "send_traceparent": true }'Body is a full ProviderMetadata. Server validates shape: provider-level id + region non-empty; models[] non-empty with unique name per entry; per-model contextWindow positive integer; per-model features against the closed enum; per-model cost non-negative; optional per-model p95LatencyMs / maxOutputTokens well-shaped; optional labels within their limits — same rules as @kindgi/capabilities.createProviderRegistry. Secrets (API keys, endpoints) are NOT part of the wire shape; deployments store them inside the binding. When the runtime has the adapter the body names, that adapter checks the registration first (its adapter_config, the metadata and the presence of secret_ref; static: no network, no secret read): a problem refuses it with 422 provider-config-invalid. A model provider’s key is used by its provider only: a secret_ref naming a secret that a tool, an MCP endpoint or a webhook endpoint already uses is refused (409 provider-key-in-use), and from then on the name is refused to tools and endpoints.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “Responses”Provider registered.
object
Examplegenerated
{ "providerId": "example"}Validation failed (see details.reason), a secret_ref.name under the reserved kindgi. prefix among them (bad-input). Or connection-key-refused: a secret it names is the account key of a texts connection app registration (details.secret, details.appId), which only that registration names. Use a key of its own: a new API key from the provider, stored under its own name. A copy of this one under another name reaches the same account. Or identity-provider-key-refused: a secret it names is an identity provider’s secret, an OIDC client secret or a SAML signing or decryption key (details.secret, details.identityProviderId), which only sign-in names. If one app registration serves both, give it a second secret of its own (a second client secret), store that under its own name and use that name.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Not a tenant admin (permission-denied). Without an authorization store, a tenant admin is the deployment’s API token, an admin key, or a console signed in with either.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Provider already registered at that id. Or provider-key-in-use: secret_ref names a secret that a tool (its current version), an MCP endpoint, a webhook endpoint, a webhook trigger or a destination uses; details.usedBy lists each (kind, id, a tool’s version). Store the provider’s key under its own name. Nothing is stored. Or env-not-served: this runtime keeps every value under the env it serves (whoami’s servedEnv, with refusesOtherEnvs), and the secret reference names another. Name it under details.servedEnv. Nothing is stored. Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}provider-config-invalid: a send_traceparent that isn’t a boolean, or the provider’s adapter refuses the registration (its adapter_config, its metadata, or a missing secret_ref); details.issues lists each (path, a JSON pointer, and message), the registration’s own fields first, as other validation errors do. Nothing is stored.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The Idempotency-Key store (idempotency-store-unavailable) or the authorization store (authz-backend-unavailable) couldn’t be reached before the request ran, or the database was too busy for its authorization check (database-busy), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
GET /v1/providers: List model providers- Models
- Kindgi 0.4.0
- Error code
authz-backend-unavailable - Error code
bad-input - Error code
connection-key-refused - Error code
database-busy - Error code
env-not-served - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
identity-provider-key-refused - Error code
permission-denied - Error code
provider-config-invalid - Error code
provider-key-in-use - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code