Skip to content

LLM Providers

Configure the language model providers that power your agents. Each provider config stores an encrypted API key and exposes a test endpoint. Agents reference providers by their configured name.

Base path: /api/llm-providers

All endpoints require Authorization: Bearer <token>.

API Key Security

API keys are encrypted at rest using AES-GCM-256. They are never returned in plaintext after creation — the key field is always masked as "***" in read responses.


Supported Providers

ProviderModels
openaiGPT-4o, GPT-4o-mini, o1, o3
anthropicClaude Opus, Sonnet, Haiku
googleGemini 2.0, Gemini Flash
xaiGrok-2, Grok-2 Vision
mistralMistral Large, Small, Codestral
deepseekDeepSeek-V3, DeepSeek-R1
cohereCommand R+, Command R
moonshotMoonshot v1
minimaxMiniMax Text, MiniMax Vision
zaiZAI models
nvidiaNVIDIA NIM endpoints
openrouter100+ models via OpenRouter routing
claude-codeClaude Code (agentic coding)
ollamaLocal Ollama models
groqLlama 3.3, Mixtral (Groq inference)
cerebrasLlama 3.1 (Cerebras inference)
customAny OpenAI-compatible endpoint

List Providers

GET /api/llm-providers

Query parameters: provider, status, limit, offset

Response:

json
{
  "success": true,
  "data": [
    {
      "id": "llm_01J...",
      "name": "Primary Anthropic",
      "provider": "anthropic",
      "model": "claude-sonnet-4-6",
      "status": "active",
      "isDefault": true,
      "createdAt": "2026-02-01T09:00:00Z"
    },
    {
      "id": "llm_02J...",
      "name": "Groq Fast",
      "provider": "groq",
      "model": "llama-3.3-70b-versatile",
      "status": "active",
      "isDefault": false,
      "createdAt": "2026-03-10T14:00:00Z"
    }
  ]
}

curl:

bash
curl "https://api.cortex.acrobi.com/api/llm-providers" \
  -H "Authorization: Bearer <token>"

Create Provider

POST /api/llm-providers

Request body:

json
{
  "name": "Primary Anthropic",
  "provider": "anthropic",
  "apiKey": "sk-ant-...",
  "model": "claude-sonnet-4-6",
  "baseUrl": null,
  "isDefault": true,
  "config": {
    "maxTokens": 8192,
    "temperature": 0.7
  }
}
FieldTypeRequiredDescription
namestringYesHuman-readable label
providerstringYesProvider identifier (see table above)
apiKeystringYesAPI key — encrypted immediately on receipt
modelstringNoDefault model to use with this provider
baseUrlstringNoCustom base URL (required for ollama, custom)
isDefaultbooleanNoMake this the org-default provider
configobjectNoProvider-specific defaults (temperature, maxTokens, etc.)

Response: 201 Created

json
{
  "success": true,
  "data": {
    "id": "llm_01J...",
    "name": "Primary Anthropic",
    "provider": "anthropic",
    "model": "claude-sonnet-4-6",
    "apiKey": "***",
    "status": "active",
    "isDefault": true,
    "createdAt": "2026-04-03T12:00:00Z"
  }
}

curl:

bash
curl -X POST "https://api.cortex.acrobi.com/api/llm-providers" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Primary Anthropic",
    "provider": "anthropic",
    "apiKey": "sk-ant-...",
    "model": "claude-sonnet-4-6",
    "isDefault": true
  }'

Get Provider

GET /api/llm-providers/:id

Response:

json
{
  "success": true,
  "data": {
    "id": "llm_01J...",
    "name": "Primary Anthropic",
    "provider": "anthropic",
    "model": "claude-sonnet-4-6",
    "apiKey": "***",
    "baseUrl": null,
    "isDefault": true,
    "status": "active",
    "config": {
      "maxTokens": 8192,
      "temperature": 0.7
    },
    "createdAt": "2026-02-01T09:00:00Z",
    "updatedAt": "2026-04-03T12:00:00Z"
  }
}

Update Provider

PATCH /api/llm-providers/:id

To rotate an API key, include apiKey in the body — it will be re-encrypted.

Request body:

json
{
  "model": "claude-opus-4-6",
  "apiKey": "sk-ant-new-key...",
  "config": { "maxTokens": 16384 }
}

Response: 200 OK — returns updated provider with apiKey: "***".


Delete Provider

DELETE /api/llm-providers/:id

Agents referencing this provider will fall back to the org default.

Response:

json
{ "success": true }

Test Connection

Sends a minimal inference request to verify the API key is valid and the provider is reachable.

POST /api/llm-providers/:id/test

No request body required.

Response: 200 OK

json
{
  "success": true,
  "data": {
    "connected": true,
    "provider": "anthropic",
    "model": "claude-sonnet-4-6",
    "latencyMs": 312,
    "responsePreview": "Hello! I'm Claude..."
  }
}

If the key is invalid:

json
{
  "success": false,
  "data": {
    "connected": false,
    "provider": "anthropic",
    "error": "401 authentication_error: invalid x-api-key"
  }
}

curl:

bash
curl -X POST "https://api.cortex.acrobi.com/api/llm-providers/llm_01J.../test" \
  -H "Authorization: Bearer <token>"

Built by Acrobi