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

# Models

> List and retrieve language models for inference

The Models API allows you to list and retrieve information about available language models in the Prime Intellect Inference service.

## Base URL

```
https://api.pinference.ai/api/v1
```

## Authentication

All requests require a Bearer token in the Authorization header:

```bash theme={null}
Authorization: Bearer your_api_key
```

### Team Account Usage

<Warning>
  When using a team account, you must include the `X-Prime-Team-ID` header. Without this header, requests default to your personal account instead of your team account.
</Warning>

```bash theme={null}
X-Prime-Team-ID: your-team-id-here
```

Find your Team ID on your [Team's Profile page](https://app.primeintellect.ai/dashboard/team-profile).

## List Models

Returns a list of all available models that you can use for inference requests.

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.pinference.ai/api/v1/models \
    -H "Authorization: Bearer $API_KEY"

  # With team account (add X-Prime-Team-ID header)
  curl -X GET https://api.pinference.ai/api/v1/models \
    -H "Authorization: Bearer $API_KEY" \
    -H "X-Prime-Team-ID: your-team-id-here"
  ```

  ```python Python theme={null}
  import openai

  # Personal account
  client = openai.OpenAI(
      api_key="your-api-key-here",
      base_url="https://api.pinference.ai/api/v1"
  )

  # Team account (required: set X-Prime-Team-ID header)
  client = openai.OpenAI(
      api_key="your-api-key-here",
      base_url="https://api.pinference.ai/api/v1",
      default_headers={
          "X-Prime-Team-ID": "your-team-id-here"
      }
  )

  models = client.models.list()
  for model in models.data:
      print(f"Model: {model.id}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.pinference.ai/api/v1/models', {
    headers: {
      'Authorization': 'Bearer your-api-key-here'
      // Add 'X-Prime-Team-ID': 'your-team-id-here' for team accounts
    }
  });

  const models = await response.json();
  console.log(models);
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "object": "list",
  "data": [
    {
      "id": "meta-llama/llama-3.1-70b-instruct",
      "object": "model",
      "owned_by": "meta",
      "created": 1693721698
    },
    {
      "id": "anthropic/claude-3-5-sonnet-20241022",
      "object": "model",
      "owned_by": "anthropic",
      "created": 1693721698
    }
  ]
}
```

## Get Model Details

Retrieve detailed information about a specific model.

### Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.pinference.ai/api/v1/models/meta-llama/llama-3.1-70b-instruct \
    -H "Authorization: Bearer $API_KEY"
  ```

  ```python Python theme={null}
  model = client.models.retrieve("meta-llama/llama-3.1-70b-instruct")
  print(model)
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.pinference.ai/api/v1/models/meta-llama/llama-3.1-70b-instruct', {
    headers: {
      'Authorization': 'Bearer your-api-key-here'
    }
  });

  const model = await response.json();
  console.log(model);
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "id": "meta-llama/llama-3.1-70b-instruct",
  "object": "model",
  "owned_by": "meta",
  "created": 1693721698
}
```

## Error Responses

### Model Not Found (404)

```json theme={null}
{
  "error": {
    "message": "The model 'invalid-model' does not exist",
    "type": "invalid_request_error",
    "code": "model_not_found"
  }
}
```

### Authentication Error (401)

```json theme={null}
{
  "error": {
    "message": "Invalid API key",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}
```
