Ana içeriğe geç

Create LLM Provider

Endpoint

POST /apiops/projects/{projectName}/llm-providers/{providerName}/

Authentication

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name
providerNamestringYesLLM provider name (must match the name field in the body)

Query Parameters

None

Request Body

The body is a polymorphic ConnectionConfigLlm object. It must include "_class": "llm" — without this discriminator, deserialization fails.

Full JSON Body Example

{
"_class": "llm",
"name": "deepseek-primary",
"description": "DeepSeek production provider",
"enabled": true,
"providerType": "DEEPSEEK",
"endpoint": "https://api.deepseek.com/v1",
"apiVersion": "v1",
"authScheme": "BEARER",
"authHeaderName": "Authorization",
"apiKey": "sk-your-deepseek-api-key",
"providerRpmLimit": 500,
"providerTpmLimit": 100000,
"coldStartRetryEnabled": false,
"deploymentType": "CLOUD",
"allowedModelIds": ["deepseek-chat"],
"supportedModels": [
{
"modelId": "deepseek-chat",
"displayName": "DeepSeek Chat",
"contextWindow": 64000,
"maxOutputTokens": 8192,
"pricePerMillionInput": 0.27,
"pricePerMillionOutput": 1.10,
"capabilities": ["chat", "function_calling"],
"modality": "TEXT"
}
],
"metadata": [
{
"key": "team",
"value": "platform",
"secret": false
}
]
}

Request Body Fields

FieldTypeRequiredDefaultDescription
_classstringYes-Polymorphic discriminator — must be "llm"
namestringYes-Provider name; must match providerName in the path (case-insensitive)
descriptionstringNo-Free-text description
enabledbooleanNotrueWhether the provider is active
providerTypestringNo-Provider type enum constant (OPENAI, ANTHROPIC, AZURE_OPENAI, BEDROCK, VERTEX, COHERE, MISTRAL, DEEPSEEK, GROQ, MOONSHOT, ZHIPU, QWEN_DASHSCOPE, VLLM, OLLAMA, CUSTOM_OPENAI_COMPAT, VOYAGE, OTHER)
endpointstringNoprovider defaultBase API URL; auto-filled from providerType when blank
apiVersionstringNoprovider defaultProvider API version; auto-filled from providerType when blank
organizationIdstringNo-Organization identifier (OpenAI org-...)
authSchemestringNoprovider defaultAuth scheme enum constant (BEARER, API_KEY_HEADER, BASIC, AWS_SIGV4, OAUTH2, NONE, CUSTOM); auto-filled from providerType when null
authHeaderNamestringNoprovider defaultCredential header name; auto-filled from providerType when blank
apiKeystringNo-Primary auth secret (Bearer token, api-key). Encrypted at rest; never returned
apiSecretstringNo-Secondary auth secret (e.g. AWS SigV4 secretKey). Encrypted at rest; never returned
regionstringNo-Region (e.g. Bedrock AWS region)
serviceAccountJsonstringNo-GCP Vertex service-account JSON blob. Encrypted at rest; never returned
supportedModelsarrayNo-Per-provider model snapshots (see fields below)
providerRpmLimitintegerNo-Organization-level requests-per-minute limit
providerTpmLimitintegerNo-Organization-level tokens-per-minute limit
coldStartRetryEnabledbooleanNo-Retry on 503 for self-hosted providers (vLLM/Ollama)
deploymentTypestringNoautoDeployment type enum constant (CLOUD, ON_PREM); auto-filled from providerType when null
providerDefinitionIdstringNo-Optional catalog provider definition reference
allowedModelIdsarray[string]No-Integration-level model filter; empty/null = all models allowed
metadataarrayNo-Custom key/value metadata entries (see fields below)

Supported Model (LlmModelDef) Fields

FieldTypeRequiredDescription
modelIdstringYesModel identifier (e.g. deepseek-chat)
displayNamestringNoHuman-readable model name
contextWindowintegerNoMaximum context window in tokens
maxOutputTokensintegerNoMaximum output tokens
pricePerMillionInputnumberNoUSD per 1M input tokens
pricePerMillionOutputnumberNoUSD per 1M output tokens
pricePerMillionCachednumberNoUSD per 1M cached tokens
capabilitiesarray[string]NoModel capabilities (e.g. chat, function_calling, vision)
modalitystringNoModality enum constant (TEXT, VISION, AUDIO, EMBEDDING, RERANK, MULTIMODAL, IMAGE)

Metadata Entry Fields

FieldTypeRequiredDescription
keystringYesMetadata key
valuestringNoMetadata value; encrypted at rest when secret is true
secretbooleanNoWhether the value is a secret (nulled in read responses)

Notes

  • _class must be "llm" or the request fails to deserialize
  • name must match providerName in the path (case-insensitive), otherwise a 400 Bad Request is returned
  • Fields left blank (endpoint, apiVersion, authScheme, authHeaderName, deploymentType) are auto-filled from the selected providerType

Response

Success Response (200 OK)

{
"status": "SUCCESS",
"deploymentResult": {
"success": true
}
}

EnumStatus

  • SUCCESS - Operation successful
  • FAILURE - Operation failed

Error Response (400 Bad Request)

{
"status": "FAILURE",
"resultMessage": "LLM provider name in path (deepseek-primary) does not match name in body (deepseek-2)!"
}

or

{
"status": "FAILURE",
"resultMessage": "LLM provider body can not be empty!"
}

Error Response (401 Unauthorized)

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

cURL Example

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/llm-providers/deepseek-primary/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"_class": "llm",
"name": "deepseek-primary",
"description": "DeepSeek production provider",
"enabled": true,
"providerType": "DEEPSEEK",
"endpoint": "https://api.deepseek.com/v1",
"apiVersion": "v1",
"authScheme": "BEARER",
"authHeaderName": "Authorization",
"apiKey": "sk-your-deepseek-api-key",
"deploymentType": "CLOUD",
"allowedModelIds": ["deepseek-chat"],
"supportedModels": [
{
"modelId": "deepseek-chat",
"displayName": "DeepSeek Chat",
"contextWindow": 64000,
"maxOutputTokens": 8192,
"modality": "TEXT"
}
]
}'

Permissions

  • User must have AI_DEVELOPMENT + MANAGE permission in the project

Notes and Warnings

  • Upsert Semantics:
    • If a provider with the same name already exists, it is updated (its internal ID is reused)
    • Otherwise a new provider is created
  • Polymorphic Discriminator:
    • "_class": "llm" is mandatory in the body
  • Secret Fields (INV-06):
    • apiKey, apiSecret and serviceAccountJson are encrypted before persistence and never returned in read responses
  • Enum Serialization:
    • Enum values (providerType, authScheme, deploymentType, model modality) must be sent as the enum constant name (e.g. DEEPSEEK, BEARER, CLOUD, TEXT), not lowercase
  • Automatic Defaults:
    • Blank endpoint/apiVersion/authScheme/authHeaderName/deploymentType are auto-filled from the providerType default
  • Deploy on Save:
    • The provider is encrypted and pushed to the AI Gateway workers as part of the save