GoodMemGoodMem
ReferenceAPIREST APILLMs

Create a new LLM

POST /v1/llms: Creates a new LLM configuration for text generation services.

POST
/v1/llms

Creates a new LLM configuration for text generation services. LLMs represent connections to different language model API services (like OpenAI, vLLM, etc.) and include all the necessary configuration to use them for text generation.

DUPLICATE DETECTION: Returns HTTP 409 Conflict (ALREADY_EXISTS) if another LLM exists with the same effective provider connection and model configuration for this owner after endpoint canonicalization and provider-default resolution. Equivalent credentials participate in the comparison. The apiPath field defaults to '/chat/completions' if omitted.

OWNER DEFAULTS: Owner defaults to the authenticated principal unless ownerId is provided; CREATE_LLM is evaluated against the proposed LLM and owner.

Authorization

ApiKeyAuth
headerx-api-key<token>

Header Parameters

GoodMem-Timeout-Ms?integer

Optional waiting budget in milliseconds, measured from REST servlet ingress and shared across all internal gRPC calls. Supply one decimal integer from 1 to 86400000. Omission adds no deadline. Existing shorter deadlines still apply. Expiry returns HTTP 504 before streaming starts; after streaming starts, no successful completion event is sent. Use SSE or opt into GoodMem-Stream-Terminal for an explicit terminal outcome. Retrieval work is cooperatively cancelled. An accepted mutation may still commit after timeout or disconnect; a failed response does not imply rollback.

Formatint64
Range1 <= value <= 86400000

Request Body

LLM configuration details

application/json
  1. body

Request body for creating a new LLM. An LLM represents a configuration for text generation services.

displayName*string

User-facing name of the LLM

Length1 <= length <= 255
Example"GPT-4 Turbo"
description?|

Description of the LLM

Example"OpenAI's GPT-4 Turbo model for chat completions"
providerType*LLMProviderType

Type of LLM provider

Example"OPENAI"
Value in"OPENAI""LITELLM_PROXY""OPEN_ROUTER""DASHSCOPE""VLLM""OLLAMA""LLAMA_CPP""CUSTOM_OPENAI_COMPATIBLE"
endpointUrl*string

API endpoint base URL (OpenAI-compatible base, typically ends with /v1)

Example"https://api.openai.com/v1"
apiPath?|

API path for chat/completions request (defaults to /chat/completions if not provided)

Default"/chat/completions"
modelIdentifier*string

Model identifier

Example"gpt-4-turbo-preview"
supportedModalities?array<>|

Supported content modalities (defaults to TEXT if not provided)

Default
[  "TEXT"]
credentials?||

Structured credential payload describing how to authenticate with the provider. Required for SaaS providers; optional for local or proxy providers.

Example
{  "kind": "CREDENTIAL_KIND_API_KEY",  "apiKey": {    "inlineSecret": "sk-llm-demo-key"  }}
labels?|

User-defined labels for categorization

Propertiesproperties <= 20
Example
{  "environment": "production",  "team": "ai"}
version?|

Version information

Example"1.0.0"
monitoringEndpoint?|

Monitoring endpoint URL

Example"https://monitoring.example.com/llms/status"
capabilities?|

LLM capabilities defining supported features and modes. Optional - server infers capabilities from model identifier if not provided.

Example
{  "supportsChat": true,  "supportsCompletion": true,  "supportsFunctionCalling": true,  "supportsSystemMessages": true,  "supportsStreaming": true,  "supportsSamplingParameters": true}
defaultSamplingParams?|

Default sampling parameters for generation requests

Example
{  "maxTokens": 2048,  "temperature": 0.7,  "topP": 0.9,  "topK": 50,  "frequencyPenalty": 0,  "presencePenalty": 0,  "stopSequences": [    "\n\n",    "END"  ]}
maxContextLength?|

Maximum context window size in tokens

Formatint32
Range1 <= value
Example32768
clientConfig?|

Provider-specific client configuration as flexible JSON structure

ownerId?|

Optional owner principal UUID. If omitted, defaults to the authenticated principal. CREATE_LLM is evaluated against the proposed LLM and owner.

Formatuuid
Example"550e8400-e29b-41d4-a716-446655440000"
llmId?|

Optional client-provided UUID for idempotent creation. If not provided, server generates a new UUID. Returns ALREADY_EXISTS if ID is already in use.

Formatuuid
Example"550e8400-e29b-41d4-a716-446655440000"
dashscopeApiDialect?|

DashScope request and response API dialect. Valid only for the DASHSCOPE provider. When omitted, a recognized apiPath determines the dialect; otherwise OPENAI_COMPATIBLE is used.

Example"LLM_NATIVE_TEXT"
Value in"LLM_NATIVE_TEXT""LLM_NATIVE_MULTIMODAL""OPENAI_COMPATIBLE"

Response Body

Successfully created LLM with status information

application/json
  1. response

Response containing the created LLM and any informational status messages

llm*

The created LLM configuration

statuses?array<>

Optional status messages providing information about server-side operations performed during creation, such as capability inference results

Example Request
curl -X POST 'https://your-goodmem-server.example.com/v1/llms' \  -H 'GoodMem-Timeout-Ms: 30000' \  -H 'Content-Type: application/json' \  -d '{  "displayName": "GPT-4 Turbo",  "description": "OpenAI'\''s GPT-4 Turbo model for chat completions",  "endpointUrl": "https://api.openai.com/v1",  "apiPath": "/chat/completions",  "modelIdentifier": "gpt-4-turbo-preview",  "supportedModalities": [    "TEXT"  ],  "credentials": {    "apiKey": {      "inlineSecret": "sk-your-api-key-here",      "secretRef": {        "uri": "vault://path/to/secret"      },      "headerName": "Authorization",      "prefix": "Bearer "    },    "kind": "CREDENTIAL_KIND_API_KEY"  },  "labels": {    "environment": "production",    "team": "ai"  },  "version": "1.0.0",  "monitoringEndpoint": "https://monitoring.example.com/llms/status",  "capabilities": {    "supportsChat": true,    "supportsCompletion": true,    "supportsFunctionCalling": true,    "supportsSystemMessages": true,    "supportsStreaming": true,    "supportsSamplingParameters": true  },  "defaultSamplingParams": {    "maxTokens": 2048,    "temperature": 0.7,    "topP": 0.9,    "topK": 50,    "frequencyPenalty": 0,    "presencePenalty": 0,    "stopSequences": [      "\n\n",      "END"    ]  },  "maxContextLength": 32768,  "ownerId": "550e8400-e29b-41d4-a716-446655440000",  "llmId": "550e8400-e29b-41d4-a716-446655440000",  "dashscopeApiDialect": "LLM_NATIVE_TEXT",  "providerType": "OPENAI"}'
Example Response
{  "llm": {    "llmId": "550e8400-e29b-41d4-a716-446655440000",    "displayName": "GPT-4 Turbo",    "description": "OpenAI's GPT-4 Turbo model for chat completions",    "providerType": "OPENAI",    "endpointUrl": "https://api.openai.com/v1",    "apiPath": "/chat/completions",    "modelIdentifier": "gpt-4-turbo-preview",    "supportedModalities": [      "TEXT"    ],    "credentials": {      "apiKey": {        "inlineSecret": "sk-1234567890abcdef",        "secretRef": {          "uri": "vault://path/to/secret"        },        "headerName": "Authorization",        "prefix": "Bearer "      },      "gcpAdc": {        "scopes": [          "https://www.googleapis.com/auth/cloud-platform"        ],        "quotaProjectId": "my-quota-project"      }    },    "labels": {      "environment": "production",      "team": "ai"    },    "version": "1.0.0",    "monitoringEndpoint": "https://monitoring.example.com/llms/status",    "capabilities": {      "supportsChat": true,      "supportsCompletion": true,      "supportsFunctionCalling": true,      "supportsSystemMessages": true,      "supportsStreaming": true,      "supportsSamplingParameters": true    },    "defaultSamplingParams": {      "maxTokens": 2048,      "temperature": 0.7,      "topP": 0.9,      "topK": 50,      "frequencyPenalty": 0,      "presencePenalty": 0,      "stopSequences": [        "\n\n",        "END"      ]    },    "maxContextLength": 32768,    "clientConfig": {      "property1": {},      "property2": {}    },    "ownerId": "550e8400-e29b-41d4-a716-446655440000",    "createdAt": 1617293472000,    "updatedAt": 1617293472000,    "createdById": "550e8400-e29b-41d4-a716-446655440000",    "updatedById": "550e8400-e29b-41d4-a716-446655440000",    "dashscopeApiDialect": "LLM_NATIVE_TEXT"  },  "statuses": [    {      "code": "VECTOR_SEARCH_PARTIAL",      "message": "Some embedders were unavailable, returning partial results"    }  ]}