> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.labelstud.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.labelstud.io/_mcp/server.

# ✨ Get model provider connection

GET http://localhost:8000/api/model-provider-connections/{id}/

This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)

Retrieve a specific model provider connection.

Reference: https://api.labelstud.io/api-reference/api-reference/model-providers/get

## Authentication

- `Authorization` header (required) (prefixed with ` Token   `) — The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example: curl [https://label-studio-host/api/projects](https://label-studio-host/api/projects) -H "Authorization: Token \[your-token]"

## Request

### Path parameters

- `id` (integer, required) — A unique integer value identifying this model provider connection.

## Response

### 200

- `budget_last_reset_date` (datetime, required, nullable) — Date and time the budget was last reset
- `budget_limit` (double, required, nullable) — Budget limit for the model provider connection (null if unlimited)
- `budget_reset_period` (enum, required, nullable) — Budget reset period for the model provider connection (null if not reset) * `Monthly` - Monthly * `Yearly` - Yearly
  - Allowed values: `Monthly`, `Yearly`
- `budget_total_spent` (double, required, nullable) — Tracked total budget spent for the given provider connection within the current budget period
- `created_at` (datetime, required)
- `created_by` (UserSimple, required) — A ModelSerializer that takes additional arguments for "fields", "omit" and "expand" in order to control which fields are displayed, and whether to replace simple values with complex, nested serializations
- `id` (integer, required)
- `model_params` (map from string to any, required) — JSON schema for the model parameters available for the provider
- `organization` (integer, required, nullable)
- `updated_at` (datetime, required)
- `budget_alert_threshold` (double, optional, nullable) — Budget alert threshold for the given provider connection
- `cached_available_models` (string, optional, nullable) — List of available models from the provider
- `deployment_name` (string, optional, nullable) — Azure OpenAI deployment name
- `endpoint` (string, optional, nullable) — Azure OpenAI endpoint
- `google_location` (string, optional, nullable) — Google project location
- `google_project_id` (string, optional, nullable) — Google project ID
- `is_internal` (boolean, optional, nullable) — Whether the model provider connection is internal, not visible to the user
- `provider` (enum, optional) — * `OpenAI` - OpenAI * `AzureOpenAI` - AzureOpenAI * `AzureAIFoundry` - AzureAIFoundry * `VertexAI` - VertexAI * `Gemini` - Gemini * `Anthropic` - Anthropic * `Custom` - Custom
  - Allowed values: `OpenAI`, `AzureOpenAI`, `AzureAIFoundry`, `VertexAI`, `Gemini`, `Anthropic`, `Custom`
- `scope` (enum, optional) — * `Organization` - Organization * `User` - User * `Model` - Model
  - Allowed values: `Organization`, `User`, `Model`

## Types

### UserSimple

A ModelSerializer that takes additional arguments for "fields", "omit" and "expand" in order to control which fields are displayed, and whether to replace simple values with complex, nested serializations

- `avatar` (string, required, nullable)
- `id` (integer, required)
- `username` (string, required)
- `email` (string, optional)
- `first_name` (string, optional)
- `last_name` (string, optional)

## Examples

**Response**

```json
{
  "budget_last_reset_date": "2024-01-15T09:30:00Z",
  "budget_limit": 1.1,
  "budget_reset_period": "Monthly",
  "budget_total_spent": 1.1,
  "created_at": "2024-01-15T09:30:00Z",
  "created_by": {
    "avatar": "string",
    "id": 1,
    "username": "string",
    "email": "string",
    "first_name": "string",
    "last_name": "string"
  },
  "id": 1,
  "model_params": {},
  "organization": 1,
  "updated_at": "2024-01-15T09:30:00Z",
  "budget_alert_threshold": 1.1,
  "cached_available_models": "string",
  "deployment_name": "string",
  "endpoint": "string",
  "google_location": "string",
  "google_project_id": "string",
  "is_internal": true,
  "provider": "OpenAI",
  "scope": "Organization"
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8000/api/model-provider-connections/1/"

headers = {"Authorization": "Token  <api_key>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'http://localhost:8000/api/model-provider-connections/1/';
const options = {method: 'GET', headers: {Authorization: 'Token  <api_key>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8000/api/model-provider-connections/1/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Token  <api_key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:8000/api/model-provider-connections/1/")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Token  <api_key>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:8000/api/model-provider-connections/1/")
  .header("Authorization", "Token  <api_key>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:8000/api/model-provider-connections/1/', [
  'headers' => [
    'Authorization' => 'Token  <api_key>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:8000/api/model-provider-connections/1/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Token  <api_key>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Token  <api_key>"]

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8000/api/model-provider-connections/1/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```