---
title: Tworzenie zabezpieczenia | RunAPI
description: Utwórz wielokrotnie używalną politykę modelu, dostawcy i budżetu.
url: https://runapi.ai/pl/docs/api/management/guardrails/create.md
canonical: https://runapi.ai/pl/docs/api/management/guardrails/create
locale: pl
---

> Wersja HTML: https://runapi.ai/pl/docs/api/management/guardrails/create
> Indeks witryny dla agentów: https://runapi.ai/llms.txt

# Tworzenie zabezpieczenia

Utwórz wielokrotnie używalną politykę modelu, dostawcy i budżetu.

## Punkt końcowy

POST /api/v1/guardrails

Bazowy URL: https://runapi.ai

Wersja API: v1

Uwierzytelnianie: Authorization: Bearer YOUR_MANAGEMENT_API_KEY


Autoryzacja: Wymaga klucza API zarządzania na poziomie administratora konta.

## Żądanie

Wysyłaj wartości wyłącznie w podanej lokalizacji żądania.

### Treść JSON

```json
{
  "allowed_models": {
    "description": "Lista dozwolonych modeli.",
    "required": false,
    "type": "array | null"
  },
  "allowed_providers": {
    "description": "Lista dozwolonych nazw dostawców.",
    "required": false,
    "type": "array | null"
  },
  "blocked_models": {
    "description": "Lista zablokowanych modeli, która ma pierwszeństwo przed listą dozwolonych.",
    "required": false,
    "type": "array | null"
  },
  "blocked_providers": {
    "description": "Lista zablokowanych nazw dostawców.",
    "required": false,
    "type": "array | null"
  },
  "credit_limit_cents": {
    "description": "Łączny limit wydatków w centach USD.",
    "required": false,
    "type": "integer | null"
  },
  "credit_limit_reset_interval": {
    "description": "Częstotliwość resetowania łącznego limitu wydatków.",
    "enum": [
      "daily",
      "weekly",
      "monthly"
    ],
    "required": false,
    "type": "string | null"
  },
  "description": {
    "description": "Opcjonalny opis w dowolnej formie.",
    "required": false,
    "type": "string"
  },
  "enabled": {
    "default": true,
    "description": "Czy zabezpieczenie jest egzekwowane.",
    "required": false,
    "type": "boolean"
  },
  "model_budgets": {
    "description": "Reguły budżetowe dla poszczególnych modeli.",
    "required": false,
    "type": "array | null"
  },
  "name": {
    "description": "Nazwa guardrail unikalna w obrębie konta.",
    "required": true,
    "type": "string"
  }
}
```

## Odpowiedź sukcesu

HTTP 201 - POST /api/v1/guardrails

```json
{
  "allowed_models": [
    "gpt-5.4"
  ],
  "allowed_providers": [],
  "assignment_count": 1,
  "blocked_models": [],
  "blocked_providers": [],
  "created_at": "2026-07-27T10:00:00.000Z",
  "credit_limit_cents": 50000,
  "credit_limit_reset_interval": "monthly",
  "description": "Production policy",
  "enabled": true,
  "id": "guardrail_123",
  "model_budgets": [
    {
      "credit_limit_cents": 10000,
      "credit_limit_reset_interval": "monthly",
      "match_mode": "include",
      "models": [
        "gpt-5.4"
      ]
    }
  ],
  "name": "Production budget"
}
```

## Odpowiedź błędu (401)

HTTP 401

### Schemat odpowiedzi

```json
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Przykład odpowiedzi

```json
{
  "error": "Authentication required"
}
```

## Odpowiedź błędu (403)

HTTP 403

### Schemat odpowiedzi

```json
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Przykład odpowiedzi

```json
{
  "error": "Management API key required"
}
```

## Odpowiedź błędu (403)

HTTP 403

### Schemat odpowiedzi

```json
{
  "properties": {
    "error": {
      "description": "Czytelny dla człowieka komunikat o błędzie.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Przykład odpowiedzi

```json
{
  "error": "Account admin required"
}
```

## Odpowiedź błędu (400)

HTTP 400

### Schemat odpowiedzi

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Czytelny dla człowieka komunikat o błędzie.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Czytelne dla człowieka podsumowanie walidacji.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Komunikaty walidacyjne identyfikowane przez publiczne pole żądania, z tablicą czytelnych dla człowieka ciągów znaków dla każdego pola.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### Przykład odpowiedzi

```json
{
  "error": "page must be an integer"
}
```

## Odpowiedź błędu (422)

HTTP 422

### Schemat odpowiedzi

```json
{
  "properties": {
    "error": {
      "description": "Czytelne dla człowieka podsumowanie walidacji.",
      "type": "string"
    },
    "errors": {
      "additionalProperties": {
        "items": {
          "type": "string"
        },
        "type": "array"
      },
      "description": "Komunikaty walidacyjne identyfikowane przez publiczne pole żądania, z tablicą czytelnych dla człowieka ciągów znaków dla każdego pola.",
      "type": "object"
    }
  },
  "required": [
    "error",
    "errors"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Przykład odpowiedzi

```json
{
  "error": "Validation failed",
  "errors": {
    "base": [
      "Validation failed"
    ]
  }
}
```

## Przykład cURL



### curl

```curl
curl -X POST https://runapi.ai/api/v1/guardrails \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"name":"Production budget","description":"Production policy","enabled":true,"credit_limit_cents":50000,"credit_limit_reset_interval":"monthly","allowed_models":["gpt-5.4"],"model_budgets":[{"match_mode":"include","models":["gpt-5.4"],"credit_limit_cents":10000,"credit_limit_reset_interval":"monthly"}]}'
```

## Powiązane materiały referencyjne

- [Zabezpieczenia](https://runapi.ai/pl/docs/api/management/guardrails.md)
- [Obiekt Guardrail](https://runapi.ai/pl/docs/api/management/guardrails/object.md)

---

## Więcej od RunAPI

- [Strona główna](https://runapi.ai/pl/.md)
- [Katalog modeli](https://runapi.ai/pl/models.md)
- [Cennik](https://runapi.ai/pl/pricing.md)
- [Dostawcy](https://runapi.ai/pl/models)
- [Dokumentacja](https://runapi.ai/pl/docs/guides)
- [SDK](https://runapi.ai/pl/sdk.md)
- [CLI](https://runapi.ai/pl/cli.md)
- [Serwer MCP](https://runapi.ai/pl/mcp.md)
- [Claude Code vs Cursor](https://runapi.ai/pl/claude-code-vs-cursor.md)
- [Konfiguracja Cursor API](https://runapi.ai/pl/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/pl/openrouter-alternative.md)
- [Enterprise](https://runapi.ai/pl/contact.md)
- [Kontakt](https://runapi.ai/pl/contact.md)
- [Regulamin](https://runapi.ai/pl/terms.md)
- [Prywatność](https://runapi.ai/pl/privacy.md)
- [Indeks witryny dla agentów](https://runapi.ai/llms.txt)

Kontakt: contact@runapi.ai

## Dane strukturalne

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "pl",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/pl",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/pl/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "pl",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/pl",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/plicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "pl",
    "@type": "TechArticle",
    "headline": "Tworzenie zabezpieczenia",
    "description": "Utwórz wielokrotnie używalną politykę modelu, dostawcy i budżetu.",
    "url": "https://runapi.ai/pl/docs/api/management/guardrails/create",
    "mainEntityOfPage": "https://runapi.ai/pl/docs/api/management/guardrails/create"
  }
]
```
