This feature is in beta
To use this feature, pass in a header including the
LD-API-Version
key with value set tobeta
. Use this header with each call. To learn more, read Beta resources.Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. The AI configs API allows you to create, retrieve, and edit AI configs, AI config variations, and AI model configurations.
An AI config is a resource in LaunchDarkly that you can use to customize, test, and roll out new large language models (LLMs) within your generative AI applications. Within each AI config, you define one or more AI config variations, each of which includes a model configuration and one or more messages. The model configuration can be a standard one from the list provided by LaunchDarkly, or you can define your own custom AI model configuration.
To learn more, read AI configs.
Get a list of all AI configs in the given project.
Successful response
Bad request
Forbidden
Not found
Internal server error
{- "_links": {
- "next": {
- "href": "href",
- "type": "type"
}, - "last": {
- "href": "href",
- "type": "type"
}, - "prev": {
- "href": "href",
- "type": "type"
}, - "self": {
- "href": "href",
- "type": "type"
}, - "first": {
- "href": "href",
- "type": "type"
}
}, - "totalCount": 7,
- "items": [
- {
- "createdAt": 5,
- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}, - "self": {
- "href": "href",
- "type": "type"
}
}, - "variations": [
- {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}, - {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
], - "name": "name",
- "description": "description",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
], - "updatedAt": 2
}, - {
- "createdAt": 5,
- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}, - "self": {
- "href": "href",
- "type": "type"
}
}, - "variations": [
- {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}, - {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
], - "name": "name",
- "description": "description",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
], - "updatedAt": 2
}
]
}
Create a new AI config within the given project.
AI config created
Bad request
Forbidden
Internal server error
{- "name": "name",
- "description": "",
- "key": "key",
- "tags": [
- "tags",
- "tags"
]
}
{- "createdAt": 5,
- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}, - "self": {
- "href": "href",
- "type": "type"
}
}, - "variations": [
- {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}, - {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
], - "name": "name",
- "description": "description",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
], - "updatedAt": 2
}
Delete an existing AI config.
No content
Bad request
Forbidden
Not found
Internal server error
{- "code": "code",
- "message": "message"
}
Retrieve a specific AI config by its key.
AI config found
Bad request
Forbidden
Not found
Internal server error
{- "createdAt": 5,
- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}, - "self": {
- "href": "href",
- "type": "type"
}
}, - "variations": [
- {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}, - {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
], - "name": "name",
- "description": "description",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
], - "updatedAt": 2
}
Edit an existing AI config.
The request body must be a JSON object of the fields to update. The values you include replace the existing values for the fields.
Here's an example:
{
"description": "Example updated description",
"tags": ["new-tag"]
}
AI config updated
Bad request
Forbidden
Not found
Internal server error
{- "name": "name",
- "description": "description",
- "tags": [
- "tags",
- "tags"
]
}
{- "createdAt": 5,
- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}, - "self": {
- "href": "href",
- "type": "type"
}
}, - "variations": [
- {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}, - {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
], - "name": "name",
- "description": "description",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
], - "updatedAt": 2
}
Create a new variation for a given AI config.
The model
in the request body requires a modelName
and parameters
, for example:
"model": {
"modelName": "claude-3-opus-20240229",
"parameters": {
"max_tokens": 1024
}
}
AI config variation object to create
AI config variation created
Bad request
Forbidden
Internal server error
{- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "key": "key"
}
{- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
Delete a specific variation of an AI config by config key and variation key.
No content
Bad request
Forbidden
Not found
Internal server error
{- "code": "code",
- "message": "message"
}
Get an AI config variation by key. The response includes all variation versions for the given variation key.
Successful response
Bad request
Forbidden
Not found
Internal server error
{- "totalCount": 0,
- "items": [
- {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}, - {
- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
]
}
Edit an existing variation of an AI config. This creates a new version of the variation.
The request body must be a JSON object of the fields to update. The values you include replace the existing values for the fields.
Here's an example:
{
"messages": [
{
"role": "system",
"content": "The new message"
}
]
}
AI config variation object to update
AI config variation updated
Bad request
Forbidden
Not found
Internal server error
{- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "published": true,
- "modelConfigKey": "modelConfigKey"
}
{- "createdAt": 6,
- "_links": {
- "parent": {
- "href": "href",
- "type": "type"
}
}, - "publishedAt": 5,
- "name": "name",
- "messages": [
- {
- "role": "role",
- "content": "content"
}, - {
- "role": "role",
- "content": "content"
}
], - "model": "{}",
- "modelConfigKey": "modelConfigKey",
- "version": 1,
- "key": "key"
}
Retrieve usage metrics for an AI config by config key.
Metrics computed
Bad request
Forbidden
Not found
Internal server error
{- "generationCount": 5,
- "generationSuccessCount": 5,
- "inputTokens": 0,
- "generationErrorCount": 2,
- "thumbsDown": 9,
- "timeToFirstTokenMs": 2,
- "outputTokens": 6,
- "totalTokens": 1,
- "thumbsUp": 7,
- "durationMs": 3
}
Retrieve usage metrics for an AI config by config key, with results split by variation.
Metrics computed
Bad request
Forbidden
Not found
Internal server error
[- {
- "metrics": {
- "generationCount": 5,
- "generationSuccessCount": 5,
- "inputTokens": 0,
- "generationErrorCount": 2,
- "thumbsDown": 9,
- "timeToFirstTokenMs": 2,
- "outputTokens": 6,
- "totalTokens": 1,
- "thumbsUp": 7,
- "durationMs": 3
}, - "variationKey": "variationKey"
}
]
Get all AI model configs for a project.
Successful response
Bad request
Forbidden
Not found
Internal server error
[- {
- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "provider": "provider",
- "customParams": "{}",
- "name": "name",
- "icon": "icon",
- "global": true,
- "id": "id",
- "params": "{}",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
]
}
]
Create an AI model config. You can use this in any variation for any AI config in your project.
AI model config object to create
Successful response
Bad request
Forbidden
Not found
Internal server error
{- "provider": "provider",
- "customParams": "{}",
- "name": "name",
- "icon": "icon",
- "id": "id",
- "params": "{}",
- "key": "key",
- "tags": [
- "tags",
- "tags"
]
}
{- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "provider": "provider",
- "customParams": "{}",
- "name": "name",
- "icon": "icon",
- "global": true,
- "id": "id",
- "params": "{}",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
]
}
Delete an AI model config.
No content
Bad request
Forbidden
Not found
Internal server error
{- "code": "code",
- "message": "message"
}
Get an AI model config by key.
Successful response
Bad request
Forbidden
Not found
Internal server error
{- "_access": {
- "allowed": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
], - "denied": [
- {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}, - {
- "reason": {
- "role_name": "role_name",
- "notActions": [
- null,
- null
], - "notResources": [
- "notResources",
- "notResources"
], - "effect": "allow",
- "resources": [
- "proj/*:env/*;qa_*:/flag/*"
], - "actions": [
- "*"
]
}, - "action": "action"
}
]
}, - "provider": "provider",
- "customParams": "{}",
- "name": "name",
- "icon": "icon",
- "global": true,
- "id": "id",
- "params": "{}",
- "version": 0,
- "key": "key",
- "tags": [
- "tags",
- "tags"
]
}