# get\_\_ai\_llm\_available

{% hint style="info" %}
This API endpoint is currently available only in the TEST environment. It is not yet available in production.
{% endhint %}

`GET /ai/llm/available`

*Get Available AI LLM Configurations*

Retrieve all AI/LLM provider configurations that are available for use. This endpoint returns configurations that can be associated with repositories or used for AI-powered features.

**Key Differences from GET /ai/llm:**

* This endpoint returns only configurations that are available and ready for use
* Configurations must be validated and active
* Useful for selecting AI providers when creating or updating repositories

**Use Cases:**

* Populate dropdown lists when configuring repositories
* Display available AI options to users
* Verify which AI providers are configured and accessible

**Important Notes:**

* API secrets are never returned in responses (only masked/null values)
* Results are filtered based on workspace access permissions
* Configurations are sorted by creation date (newest first)

#### TypeScript Client Library

```typescript
public getAvailableAiLlms = async (): Promise<GetAiLlmsResponse> => {
  return this.makeRequest<GetAiLlmsResponse>('ai/llm/available', 'GET', null);
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X GET https://backend.flashback.tech/ai/llm/available \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
GET https://backend.flashback.tech/ai/llm/available HTTP/1.1
Host: backend.flashback.tech
Accept: application/json
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

fetch('https://backend.flashback.tech/ai/llm/available',
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get 'https://backend.flashback.tech/ai/llm/available',
  params: {
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('https://backend.flashback.tech/ai/llm/available', headers = headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET','https://backend.flashback.tech/ai/llm/available', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/ai/llm/available");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://backend.flashback.tech/ai/llm/available", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

#### Parameters <a href="#get__ai_llm_available-parameters" id="get__ai_llm_available-parameters"></a>

This endpoint does not require any parameters.

> Example responses

> 200 Response

```json
{
  "success": true,
  "aiLlms": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "orgId": "org-123",
      "workspaceId": "workspace-123",
      "userId": "user-456",
      "name": "Production OpenAI",
      "aiType": "OPENAI",
      "endpoint": "https://api.openai.com/v1",
      "key": null,
      "createdAt": "2024-01-15T10:30:00.000Z",
      "repos": []
    },
    {
      "id": "660f9511-f3ac-52e5-b827-557766551111",
      "orgId": "org-123",
      "workspaceId": "workspace-123",
      "userId": "user-456",
      "name": "Anthropic Claude",
      "aiType": "ANTHROPIC",
      "endpoint": "https://api.anthropic.com/v1",
      "key": null,
      "createdAt": "2024-01-14T08:20:00.000Z",
      "repos": [
        {
          "id": "repo-789",
          "name": "ai-repo",
          "createdAt": "2024-01-16T08:00:00.000Z"
        }
      ]
    }
  ]
}
```

#### Responses <a href="#get__ai_llm_available-responses" id="get__ai_llm_available-responses"></a>

| Status | Meaning                                                                    | Description                                     | Schema |
| ------ | -------------------------------------------------------------------------- | ----------------------------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Successfully retrieved available configurations | Inline |
| 403    | [Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)             | Insufficient permissions                        | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Failed to retrieve configurations               | Inline |

#### Response Schema <a href="#get__ai_llm_available-responseschema" id="get__ai_llm_available-responseschema"></a>

Status Code **200**

| Name           | Type      | Required | Restrictions | Description                              |
| -------------- | --------- | -------- | ------------ | ---------------------------------------- |
| » success      | boolean   | false    | none         | Operation success status                 |
| » aiLlms       | \[object] | false    | none         | Array of available AI LLM configurations |
| »» id          | string    | false    | none         | Unique identifier for the configuration  |
| »» orgId       | string    | false    | none         | Organization ID                          |
| »» workspaceId | string    | false    | none         | Workspace ID                             |
| »» userId      | string    | false    | none         | User ID who created the configuration    |
| »» name        | string    | false    | none         | Configuration name                       |
| »» aiType      | string    | false    | none         | AI provider type (OPENAI, GOOGLE, etc.)  |
| »» endpoint    | string    | false    | none         | API endpoint URL                         |
| »» key         | string    | false    | none         | Access key (always null for security)    |
| »» createdAt   | string    | false    | none         | ISO 8601 timestamp                       |
| »» repos       | \[object] | false    | none         | Associated repositories (optional)       |
| »»» id         | string    | false    | none         | Repository ID                            |
| »»» name       | string    | false    | none         | Repository name                          |
| »»» createdAt  | string    | false    | none         | Repository creation timestamp            |

Status Code **403**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description |
| --------- | ------- | -------- | ------------ | ----------- |
| » success | boolean | false    | none         | none        |
| » message | string  | false    | none         | none        |

To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth
