Create a custom model

Create a new custom LLM model for the organization. One row per (credentialId, modelId) binding — a second create for a pair the organization already holds is refused with 409 model_already_added, unless it is a managed (aliased) model, which may share a binding.

POST/api/models

Authorization

better-auth.session_token<token>

Cookie session from Better Auth. Requires X-Org-Id header for org-scoped routes.

In: cookie

Header Parameters

X-Org-Id?string

Organization ID. Required for cookie auth. Not needed for API key auth (org resolved from key).

Formatuuid

Request Body

application/json

curl -X POST "https://your-instance/api/models" \  -H "Content-Type: application/json" \  -d '{    "modelId": "string",    "credentialId": "string"  }'
{
  "id": "string",
  "label": "string",
  "apiShape": "string",
  "providerId": "string",
  "provider_name": "string",
  "pi_provider": "string",
  "pi_dialect": {},
  "base_url": "string",
  "modelId": "string",
  "generation": {
    "temperature": "supported",
    "reasoning": {
      "supported": "supported",
      "temperature_compatible": "supported",
      "adaptive": true,
      "levels": {
        "property1": "supported",
        "property2": "supported"
      }
    }
  },
  "input": [
    "text"
  ],
  "contextWindow": 0,
  "maxTokens": 0,
  "reasoning": true,
  "enabled": true,
  "is_default": true,
  "needs_reconnection": true,
  "aliased": true,
  "iconUrl": "string",
  "source": "built-in",
  "credentialId": "string",
  "cost": {
    "input": 0,
    "output": 0,
    "cacheRead": 0,
    "cacheWrite": 0,
    "tiers": [
      {
        "inputTokensAbove": 0,
        "input": 0,
        "output": 0,
        "cacheRead": 0,
        "cacheWrite": 0
      }
    ]
  },
  "created_by": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}

{
  "type": "https://docs.appstrate.dev/errors/validation-failed",
  "title": "Validation Failed",
  "status": 400,
  "detail": "name: Invalid input: expected string, received undefined (+2 more)",
  "code": "validation_failed",
  "request_id": "req_abc123",
  "errors": [
    {
      "field": "name",
      "code": "required",
      "message": "Invalid input: expected string, received undefined"
    },
    {
      "field": "email",
      "code": "invalid_format",
      "message": "Invalid email address"
    },
    {
      "field": "age",
      "code": "invalid_type",
      "message": "Invalid input: expected number, received string"
    }
  ]
}

{
  "type": "https://docs.appstrate.dev/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Invalid or missing session",
  "code": "unauthorized",
  "request_id": "req_abc123"
}
{
  "type": "https://docs.appstrate.dev/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "Insufficient permissions",
  "code": "forbidden",
  "request_id": "req_abc123"
}
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "code": "string",
  "request_id": "string",
  "param": "string",
  "retry_after": 0,
  "errors": [
    {
      "field": "string",
      "code": "string",
      "message": "string",
      "title": "string",
      "candidate_connections": [
        {
          "id": "string",
          "label": "string",
          "account_id": "string",
          "owned_by_actor": true,
          "needs_reconnection": true
        }
      ],
      "connection_id": "string",
      "missing_scopes": [
        "string"
      ],
      "owned_by_actor": true,
      "required_scopes": [
        "string"
      ],
      "auth_key": "string",
      "required_auth_key": "string",
      "available_auth_keys": [
        "string"
      ],
      "connect_url": "http://example.com",
      "expiresAt": "2019-08-24T14:15:22Z",
      "packageId": "string"
    }
  ]
}