Create AI Connection
POSThttps://api.confident-ai.com/v1/ai-connections
Registers your LLM application's endpoint as an AI connection and returns its id. The endpoint is called once to determine whether the connection is active, which you read back from the single-connection route. Requires the Starter plan or above.
curl -X POST "https://api.confident-ai.com/v1/ai-connections" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Chatbot",
"endpoint": "https://api.example.com/chat",
"payload": {
"query": "{{input}}"
},
"headers": [
{
"key": "Authorization",
"value": "Bearer YOUR-TOKEN"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"actualOutputKeyPath": [
"choices",
0,
"message",
"content"
]
}'{
"success": true,
"data": {
"id": "AI-CONNECTION-ID"
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Request body
namestringRequiredUnique within the project.
typeenumHow Confident AI reaches your application.
AGENT_HANDLERneeds no endpoint.Show 3 enum valuesHide 3 enum values
ENDPOINTRELAY_ENDPOINTAGENT_HANDLER
endpointstringThe
https://URL Confident AI calls —wss://whenresponseModeisWEBSOCKET.responseModeenumHow your endpoint replies. Streaming modes read the answer from an event stream rather than a completed body.
Show 4 enum valuesHide 4 enum values
HTTP_RESPONSESSE_STREAMINGHTTP_STREAMINGWEBSOCKET
asyncResponsebooleanYour endpoint acknowledges the request and posts results back later. Requires a
responseModeofHTTP_RESPONSE.timeoutintegerSeconds to wait for a response. Defaults to 60.
maxConcurrencyintegerMost simultaneous requests Confident AI will make.
maxRetriesintegerRetries per failed request.
defaultNumGenerationsintegerHow many times to call the endpoint per test case, so one unlucky output doesn't skew results.
headerslist of objectsFull replacement of the header list — include every header the connection should keep.
Show 2 propertiesHide 2 properties
keystringRequiredThe header or parameter name.
valuestringRequiredThe value. Read back masked unless the key is a common protocol header such as
Content-Type.
queryParamslist of objectsFull replacement of the query-parameter list.
Show 2 propertiesHide 2 properties
keystringRequiredThe header or parameter name.
valuestringRequiredThe value. Read back masked unless the key is a common protocol header such as
Content-Type.
payloadobjectThe request body template sent to your endpoint.
hyperparametersobjectRecorded against every test run that uses this connection.
authenticationobjectAuth configuration (Auth0, HMAC, or Azure AD). Secret values are read back masked.
cloudProviderobjectVault configuration for pulling credentials at call time.
actualOutputKeyPathlist of string | integerWhere your application's answer lives in the response. A connection needs this (or a transformer) to be usable.
Show 2 variantsHide 2 variants
string
- OR
integer
retrievalContextKeyPathlist of string | integerWhere the retrieved context lives, for RAG applications.
Show 2 variantsHide 2 variants
string
- OR
integer
toolsCalledKeyPathlist of string | integerWhere the list of called tools lives, for agents.
Show 2 variantsHide 2 variants
string
- OR
integer
stateKeyPathlist of string | integerWhere multi-turn state lives, carried between simulated turns.
Show 2 variantsHide 2 variants
string
- OR
integer
actualOutputTransformerIdstringExtract the output by running a transformer instead of walking a key path. Send this or
actualOutputKeyPath, never both.retrievalContextTransformerIdstringAs above, for the retrieved context.
toolsCalledTransformerIdstringAs above, for the called tools.
stateTransformerIdstringAs above, for multi-turn state.
actualOutputEventstringStreaming modes only — which event carries the output.
retrievalContextEventstringStreaming modes only — which event carries the retrieved context.
toolsCalledEventstringStreaming modes only — which event carries the called tools.
stateEventstringStreaming modes only — which event carries the state.
actualOutputAccumulatebooleanStreaming modes only — concatenate the streamed chunks rather than taking the last one.
Response
The id of the created AI connection.
successbooleanIndicates if the request was successful.
dataobjectThe id of the affected AI connection.
Show 1 propertyHide 1 property
idstringThe id of the affected AI connection.
deprecatedbooleanIndicates if this endpoint is deprecated.