> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# External Model Connection APIs

[Back to API List](https://koreai.mintlify.site/agent-platform/v1/apis.md)

Use the Connections API to programmatically manage external model connections for OpenAI, Azure OpenAI, Anthropic, custom API providers, and other integrations.

**Prerequisites**

Before using these APIs, ensure your API App has the following scopes enabled:

* **View Connections** – Required for viewing connection details
* **Manage Connections** – Required for creating and updating connections

### Base URL

```
https://{host}/api/public
```

### Common Request Headers

| Header | Required | Description |
| :- | :- | :- |
| `x-api-key` | Yes | API key for authentication |
| `Content-Type` | Yes | `application/json` |

## API List

| API | Description | Method | Endpoint |
| :- | :- | :- | :- |
| [List All Connections](#list-all-connections) | Retrieves all configured connections | GET | `/connections` |
| [Get Connection by ID](#get-connection-by-id) | Retrieves a specific connection | GET | `/connections/{connectionId}` |
| [Create Connection](#create-connection) | Creates a new connection | POST | `/connections` |
| [Update Connection](#update-connection) | Updates an existing connection | PATCH | `/connections/{connectionId}` |

### List All Connections

Retrieves a list of all configured connections with optional filtering.

| Method | Endpoint |
| :- | :- |
| GET | `https://{{host}}/api/public/connections` |

#### Query Parameters

| Parameter | Required | Type | Description |
| :- | :- | :- | :- |
| `provider` | No | String | Filter by provider. Accepted values: `Open AI`, `Anthropic`, `Azure Open AI`, `API` |
| `status` | No | String | Filter by status. Accepted values: `ACTIVE`, `INACTIVE` |
| `limit` | No | Integer | Maximum number of results to return |

#### Sample Request

```
curl --location 'https://{{host}}/api/public/connections?limit=10' \
--header 'x-api-key: {{apiKey}}` \
--header 'Content-Type: application/json'
```

#### Sample Response

```
{

  "connections": [
    {
      "connectionId": "cn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "connectionName": "OpenAI GPT-4o",
      "provider": "Open AI",
      "model": "gpt-4o",
      "status": "ACTIVE",
      "createdOn": "2024-01-15T10:30:00.000Z",
      "modifiedOn": "2024-01-15T10:30:00.000Z"
    }
  ],
  "total": 1
}
```

***

### Get Connection by ID

Retrieves the details of a specific connection using its unique identifier.

| Method | Endpoint |
| :- | :- |
| GET | `https://{{host}}/api/public/connections/{connectionId}` |

#### Path Parameters

| Parameter | Required | Type | Description |
| :- | :- | :- | :- |
| `connectionId` | Yes | String | The unique identifier of the connection |

#### Sample Request

```
curl --location 'https://{{host}}/api/public/connections/{{connectionId}}` \
--header 'x-api-key: {{apiKey}}' \
--header 'Content-Type: application/json'
```

#### Sample Response

```
{
  "connectionId": "cn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "connectionName": "OpenAI GPT-4o",
  "provider": "Open AI",
  "model": "gpt-4o",
  "status": "ACTIVE",
  "fields": {
    "API_KEY": "sk-***************"
  },
  "createdOn": "2024-01-15T10:30:00.000Z",
  "modifiedOn": "2024-01-15T10:30:00.000Z"
}
```

***

### Create Connection

Creates a new connection to an external model provider. Supports creation of Custom API, OpenAI, Azure OpenAI, Anthropic, and other external model connections.

| Method | Endpoint |
| :- | :- |
| POST | `https://{{host}}/api/public/connections` |

**Body Parameters**

| Parameter | Required | Type | Description |
| :- | :- | :- | :- |
| `provider` | Yes | String | The provider type. Accepted values: `API`, `Open AI`, `Azure Open AI`, or `Anthropic` |
| `connectionName` | Yes | String | Display name for the connection |
| `model` | Conditional | String | Model identifier. Required for `Open AI`, `Azure Open AI`, and `Anthropic `providers |
| `modelType` | Conditional | String | Set to `EASY_INTEGRATION` for `Azure Open AI` and `Anthropic` providers |
| `fields` | Yes | Object | Provider-specific configuration fields |

#### Sample Request – Custom API Connection - Default Provider

```
curl --location '{{BASE_URL}}/api/public/connections' \
--header 'x-api-key: {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
  "model": "CustomProvider",
  "provider": "API",
  "connectionName": "CustomProvider",
  "promptVars": [
    {
      "name": "prompt",
      "displayName": "Prompt",
      "status": true,
      "dataType": "String",
      "elementType": "textBox",
      "defaultValue": "hlo",
      "required": true
    },
    {
      "name": "system_prompt",
      "displayName": "System prompt",
      "status": false,
      "dataType": "String",
      "elementType": "textBox",
      "defaultValue": "",
      "required": false
    },
    {
      "name": "examples",
      "displayName": "Examples",
      "status": false,
      "dataType": "String",
      "elementType": "textBox",
      "examples": true,
      "defaultValue": "",
      "required": false
    }
  ],
  "customVars": [],
  "endpointUrl": "{{LLM_API_URL}}",
  "headers": [
    {
      "key": "x-api-key",
      "value": "{{LLM_API_KEY}}"
    }
  ],
  "payload": {
    "model": "{{MODEL_NAME}}",
    "max_tokens": 1024,
    "messages": [
      {
        "role": "user",
        "content": "What is the weather like in San Francisco?"
      }
    ]
  },
  "outputPath": "content[0].text",
  "inputTokensPath": "usage.input_tokens",
  "outputTokensPath": "usage.output_tokens",
  "status": "FINALIZED",
  "isEnable": true
}'
```

**Custom API Fields (`provider: "API"`)**

| Field | Required | Type | Description |
| :- | :- | :- | :- |
| `fields.BASE_URL` | Yes | String | Base URL of the API endpoint |
| `fields.API_KEY` | Yes | String | API key for authentication |
| `fields.MODEL_NAME` | Yes | String | Model name |
| `LLM_API_URL` | Yes | String | URL for the model endpoint |
| `LLM_API_KEY` | Yes | String | API key of the model |

***

#### Sample Request – Custom API Connection - Existing Provider

```
curl --location '{{BASE_URL}}/api/public/connections' \
--header 'x-api-key: {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
  "model": "{{MODEL_NAME}}",
  "provider": "API",
  "connectionName": "Custom_Existingnew",
  "endpointUrl": "{{LLM_API_URL}}",
  "headers": [
    {
      "key": "x-api-key",
      "value": "{{LLM_API_KEY}}"
    }
  ],
  "status": "FINALIZED",
  "isEnable": true,
  "idp": "none",
  "bodyTab": "providerReferences",
  "mapProvider": "anthropicModel",
  "llmFeatures": {
    "toolCalling": false,
    "supportTools": true,
    "parallelToolCalling": true,
    "structuredResponse": true,
    "dataGeneration": false,
    "streaming": true
  },
  "IOMappings": [
    "textToText",
    "textToImage"
  ]
}'
```

**Custom API Fields (`provider: "API"`)**

| Field | Required | Type | Description |
| :- | :- | :- | :- |
| `fields.BASE_URL` | Yes | String | Base URL of the API endpoint |
| `fields.API_KEY` | Yes | String | API key for authentication |
| `fields.MODEL_NAME` | Yes | String | Model name |
| `LLM_API_URL` | Yes | String | URL for the model endpoint |
| `LLM_API_KEY` | Yes | String | API key of the model |
| `fields.IOMapping` | Yes | String | Supported values: "textToText", "textToImage", "imageToText", and "audioToText" |
| `fields.mapProvider` | Yes | String | Supported values: "anthropicModel", "geminiModel", and "openAIModel" |

***

#### Sample Request – OpenAI Connection

```
curl --location 'https://{{host}}/api/public/connections' \
--header 'x-api-key: {{apiKey}}' \
--header 'Content-Type: application/json' \
--data '{
  "provider": "Open AI",
  "connectionName": "OpenAI GPT-4o",
  "model": "gpt-4o",
  "fields": {
    "API_KEY": "sk-***************"
  }
}'
```

**OpenAI Field (`provider: "Open AI"`)**

| Field | Required | Type | Description |
| :- | :- | :- | :- |
| `fields.API_KEY` | Yes | String | Your OpenAI API key |

***

#### Sample Request – Azure OpenAI Connection

```
curl --location 'https://{{host}}/api/public/connections' \
--header 'x-api-key: {{apiKey}}' \
--header 'Content-Type: application/json' \
--data '{
  "connectionName": "Azure GPT-4",
  "provider": "Azure Open AI",
  "model": "GPT-4",
  "fields": {
    "API_KEY": "***************",
    "api_version": "2024-08-01-preview",
    "your_resource_name": "your-azure-resource",
    "deployment_id": "your-deployment-id"
  },
  "modelType": "EASY_INTEGRATION"
}'
```

**Azure OpenAI Fields (`provider: "Azure Open AI"`)**

| Field | Required | Type | Description |
| :- | :- | :- | :- |
| `fields.API_KEY` | Yes | String | Your Azure OpenAI API key |
| `fields.api_version` | Yes | String | API version (for example, `2024-08-01-preview`) |
| `fields.your_resource_name` | Yes | String | Your Azure resource name |
| `fields.deployment_id` | Yes | String | Your deployment ID |

***

#### Sample Request – Anthropic Connection

```
curl --location 'https://{{host}}/api/public/connections' \
--header 'x-api-key: {{apiKey}}' \
--header 'Content-Type: application/json' \
--data '{
  "connectionName": "Anthropic Claude",
  "provider": "Anthropic",
  "model": "claude-3-5-haiku-20241022",
  "fields": {
    "API_KEY": "***************"
  },
  "modelType": "EASY_INTEGRATION"
}'
```

**Anthropic Field (`provider: "Anthropic"`)**

| Field | Required | Type | Description |
| :- | :- | :- | :- |
| `fields.API_KEY` | Yes | String | Your Anthropic API key |

***

#### Sample Response

```
{
  "connectionId": "cn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"fields": {
       "API_KEY": "sk***************MQAA"
   },
  "connectionName": "OpenAI GPT-4o",
  "provider": "Open AI",
  "model": "gpt-4o",
  "status": "ACTIVE",
  "createdOn": "2024-01-15T10:30:00.000Z"
}
```

***

### Update Connection

Updates the configuration of an existing connection. Supported only for external provider connections where `provider` is not `API`.

| Method | Endpoint |
| :- | :- |
| PATCH | `https://{{host}}/api/public/connections/{connectionId}` |

**Path Parameters**

| Parameter | Required | Type | Description |
| :- | :- | :- | :- |
| `connectionId` | Yes | String | The unique identifier of the connection |

#### Sample Request

```
curl --location --request PATCH 'https://{{host}}/api/public/connections/{{connectionId}}' \
--header 'x-api-key: {{apiKey}}' \
--header 'Content-Type: application/json' \
--data '{
  "fields": {
    "API_KEY": "sk-***************************"
  }
}'
```

**Body Parameters**

| Parameter | Required | Type | Description |
| :- | :- | :- | :- |
| `fields` | Yes | Object | Updated configuration field, API\_KEY |

#### Sample Response

```
{
  "connectionId": "cn-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", 
"fields": {
       "API_KEY": "sk*****************MQAA"
   },
  "connectionName": "OpenAI GPT-4o",
  "provider": "Open AI",
  "model": "gpt-4o",
  "status": "ACTIVE",
  "modifiedOn": "2024-01-16T14:45:00.000Z"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.