---
title: "[Beta] Service Accounts"
description: "import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import Image from '@theme/IdealImage';"
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/service-accounts
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:46:42.307Z
license: CC-BY-4.0
attribution: "[Beta] Service Accounts — Claudary (https://claudary.paisolsolutions.com/skills/service-accounts)"
---

# [Beta] Service Accounts
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import Image from '@theme/IdealImage';

## Overview

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Image from '@theme/IdealImage';

# [Beta] Service Accounts

Use this if you want to create Virtual Keys that are not owned by a specific user but instead created for production projects

Why use a service account key?
  - Prevent key from being deleted when user is deleted.
  - Apply team limits, not team member limits to key.

## Usage

Use the `/key/service-account/generate` endpoint to generate a service account key.


```bash
curl -L -X POST 'http://localhost:4000/key/service-account/generate' \\
-H 'Authorization: Bearer sk-1234' \\
-H 'Content-Type: application/json' \\
-d '{
    "team_id": "my-unique-team"
}'
```

## Example - require `user` param for all service account requests


### 1. Set settings for Service Accounts

Set `service_account_settings` if you want to create settings that only apply to service account keys

```yaml
general_settings:
    service_account_settings: 
        enforced_params: ["user"] # this means the "user" param is enforced for all requests made through any service account keys
```

### 2. Create Service Account Key on LiteLLM Proxy Admin UI

<Image img={require('../../img/create_service_account.png')} />

### 3. Test Service Account Key 

<Tabs>

<TabItem value="Unsuccessful call" label="Unsuccessful call">


```shell
curl --location 'http://localhost:4000/chat/completions' \\
    --header 'Authorization: Bearer <sk-your-service-account>' \\
    --header 'Content-Type: application/json' \\
    --data '{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
        "role": "user",
        "content": "hello"
        }
    ]
}'
```

Expected Response

```json
{
  "error": {
    "message": "BadRequest please pass param=user in request body. This is a required param for service account",
    "type": "bad_request_error",
    "param": "user",
    "code": "400"
  }
}
```

</TabItem>

<TabItem value="Successful call" label="Successful call">


```shell
curl --location 'http://localhost:4000/chat/completions' \\
    --header 'Authorization: Bearer <sk-your-service-account>' \\
    --header 'Content-Type: application/json' \\
    --data '{
    "model": "gpt-3.5-turbo",
    "messages": [
        {
        "role": "user",
        "content": "hello"
        }
    ],
    "user": "test-user"
}'
```

Expected Response

```json
{
  "id": "chatcmpl-ad9595c7e3784a6783b469218d92d95c",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "\\n\\nHello there, how may I assist you today?",
        "role": "assistant",
        "tool_calls": null,
        "function_call": null
      }
    }
  ],
  "created": 1677652288,
  "model": "gpt-3.5-turbo-0125",
  "object": "chat.completion",
  "system_fingerprint": "fp_44709d6fcb",
  "usage": {
    "completion_tokens": 12,
    "prompt_tokens": 9,
    "total_tokens": 21,
    "completion_tokens_details": null
  },
  "service_tier": null
}
```

</TabItem>

</Tabs>

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/service-accounts) · https://claudary.paisolsolutions.com
