Skip to content
Streamkap
Esc
↑↓navigate↵open⌘Jpreview

Validate Llm Connection

Validate an LLM provider API key and model availability.

Two callable shapes:

  • Inline - raw apiKey + optional baseUrl supplied directly. Used when the user is pasting a fresh key in the form.
  • Saved connection - savedConnectionId references a stored llmConnection; BE loads the decrypted apiKey + baseUrl + provider server-side so the browser never holds the plaintext.

Calls the provider’s free list-models endpoint to check key validity and model existence. The “apiKey required unless ollama or saved” rule is enforced by the request model’s @model_validator. Per-tenant rate limit: 30 req/min/bucket -> 429 with Retry-After.

POST/agents/validate-llm
Authorization
AuthorizationBearer token · headerrequired
Request body
requiredapplication/json
providerAgentLlmProviderEnumrequired

Unified LLM provider enum.

A single AgentLlmConnection row carries one provider and a set of capabilities (chat / embedding). PROVIDER_CAPABILITIES below pins which capabilities each provider can serve — picked by the FE Connections drawer and re-validated server-side on every write.

Allowed:anthropicopenaiopenai-responsesollamaazureazure-openaibedrockqwenopenai-compatible
modelstring
max length 200 · default: ""
apiKeystring

Raw key - never stored

max length 512 · default: ""
baseUrlstring | null
Show properties
Any of:
string
string
null
null
savedConnectionIdstring | null

If set, BE resolves provider/apiKey/baseUrl from the tenant's saved llmConnection by id and ignores the inline apiKey / baseUrl.

Show properties
Any of:
string
string
null
null
Responses
200

Successful Response

object
422

Validation Error

detailValidationError[]
Show properties
Array of ValidationError
locstring | integer[]required
Show properties
Array of string | integer
Any of:
string
string
integer
integer
msgstringrequired
typestringrequired
inputany
ctxobject
Request
curl -X POST 'https://api.streamkap.com/agents/validate-llm' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "provider": "anthropic",
  "model": "",
  "apiKey": "",
  "baseUrl": "string",
  "savedConnectionId": "string"
}'
Response
{}