Update inference policy models

http
PATCH /projects/{project_reference}/inference-policy

Update the models a project allows and denies and its default model, replacing each key sent; returns the policy. Requires project.settings.manage.

Servers

JSON
[  {    "url": "https://api.veryfront.com"  }]

Authentication

JSON
[  {    "bearerAuth": []  },  {    "apiKeyAuth": []  }]
JSON
{  "bearerAuth": {    "type": "http",    "scheme": "bearer",    "bearerFormat": "JWT or API Key",    "description": "Use a JWT bearer token or a Veryfront API key in the `Authorization` header."  },  "apiKeyAuth": {    "type": "apiKey",    "in": "header",    "name": "X-API-Key",    "description": "Alternative API key header for `vf_<prefix>_<secret>` tokens."  }}

Parameters

NameLocationRequiredDescription
project_referencepathYesProject slug, UUID, or domain that identifies the project.

Parameter contracts

JSON
[  {    "schema": {      "$ref": "#/components/schemas/ProjectReference"    },    "required": true,    "description": "Project slug, UUID, or domain that identifies the project.",    "name": "project_reference",    "in": "path"  }]

Request body

JSON
{  "required": true,  "content": {    "application/json": {      "schema": {        "type": "object",        "properties": {          "models": {            "type": "object",            "properties": {              "allowed": {                "type": [                  "array",                  "null"                ],                "items": {                  "type": "string",                  "minLength": 1,                  "maxLength": 200,                  "pattern": "^[a-z0-9][a-z0-9._/-]*$",                  "description": "Model ID returned by list_models. Known catalog aliases are normalized to canonical IDs. Policy IDs use letters, digits, dots, underscores, slashes, and hyphens; arbitrary provider model strings are not accepted."                },                "maxItems": 500,                "description": "Model IDs from list_models the project allows. Null removes the restriction; an empty list allows nothing. Omit to keep the stored list."              },              "denied": {                "type": "array",                "items": {                  "type": "string",                  "minLength": 1,                  "maxLength": 200,                  "pattern": "^[a-z0-9][a-z0-9._/-]*$",                  "description": "Model ID returned by list_models. Known catalog aliases are normalized to canonical IDs. Policy IDs use letters, digits, dots, underscores, slashes, and hyphens; arbitrary provider model strings are not accepted."                },                "maxItems": 500,                "description": "Model IDs from list_models the project denies. A denial overrides an allowance. Omit to keep the stored list."              }            },            "additionalProperties": false,            "description": "Models the project allows and denies. They only narrow what its account allows."          },          "default_model": {            "type": [              "string",              "null"            ],            "minLength": 1,            "maxLength": 200,            "pattern": "^[a-z0-9][a-z0-9._/-]*$",            "description": "Default model of the project. It must be allowed by the project's and its account's policy. Null uses the account default. Omit to keep the stored value."          },          "allow_provider_key_direct_routes": {            "type": "boolean",            "description": "Whether the account's saved provider keys (for example an Anthropic key) may call their provider directly although the project states no tier. On, the default EU-resident floor does not apply to those routes, which may be served outside the EU; Veryfront's own routes keep it, and every requirement the project states (a tier, jurisdictions, hosts, models, precision) still applies. Saving a key alone never relaxes the policy. Omit to keep the stored value."          }        },        "additionalProperties": false      }    }  }}

Responses

200

The policy as it now stands

JSON
{  "description": "The policy as it now stands",  "content": {    "application/json": {      "schema": {        "$ref": "#/components/schemas/InferencePolicy"      }    }  }}

400

Bad request

JSON
{  "description": "Bad request",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

401

Unauthorized

JSON
{  "description": "Unauthorized",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

403

Requires a signed-in project administrator. API keys are rejected regardless of their scopes, including project-scoped keys.

JSON
{  "description": "Requires a signed-in project administrator. API keys are rejected regardless of their scopes, including project-scoped keys.",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

404

Not found

JSON
{  "description": "Not found",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

422

A model in models.allowed or default_model is retired (model-retired). The Problem detail names its successor; nothing is saved.

JSON
{  "description": "A model in `models.allowed` or `default_model` is retired (`model-retired`). The Problem detail names its successor; nothing is saved.",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

500

Server error

JSON
{  "description": "Server error",  "content": {    "application/problem+json": {      "schema": {        "$ref": "#/components/schemas/Problem"      }    }  }}

Referenced contracts

components/parameters/ProjectReference

JSON
{  "schema": {    "$ref": "#/components/schemas/ProjectReference"  },  "required": true,  "description": "Project slug, UUID, or domain that identifies the project.",  "name": "project_reference",  "in": "path"}

components/schemas/ProjectReference

JSON
{  "type": "string"}

components/schemas/InferencePolicy

JSON
{  "type": "object",  "properties": {    "project_id": {      "type": "string",      "format": "uuid"    },    "configured": {      "type": "boolean",      "description": "Whether the project states a policy. False returns the defaults the project is served under: EU-only, with an `eu-resident` minimum tier, while the EU default is on; every allowed model once it has ended. A row that constrains nothing is routed exactly like no row; routing changes begin at the first non-null constraint."    },    "enforced": {      "type": "boolean",      "description": "Whether the gateway can apply this stored policy. True for every readable policy: each stated constraint is enforced, and so is the default \"eu-resident\" tier floor while the EU default is on. False only when a stored value (a tier or precision) is one this build cannot read, because the gateway then refuses every request for the project instead of applying it."    },    "created_at": {      "type": [        "string",        "null"      ],      "description": "Records policy creation in ISO 8601 format, or null when no policy row exists."    },    "updated_at": {      "type": [        "string",        "null"      ],      "description": "Records the last policy update in ISO 8601 format, or null when no policy row exists."    },    "updated_by": {      "type": [        "string",        "null"      ],      "format": "uuid",      "description": "Records the user ID responsible for the last policy update, or null when no actor is recorded."    },    "models": {      "type": "object",      "properties": {        "allowed": {          "type": [            "array",            "null"          ],          "items": {            "type": "string"          },          "description": "Canonical model IDs that may be used. Null means no restriction; an empty list allows nothing."        },        "denied": {          "type": "array",          "items": {            "type": "string"          },          "description": "Canonical model IDs that may not be used. A denial overrides an allowance; an empty list denies nothing."        }      },      "required": [        "allowed",        "denied"      ],      "description": "Models the project itself allows and denies. They only narrow its account."    },    "default_model": {      "type": [        "string",        "null"      ],      "description": "The project's own default model. Null uses the account default, then the built-in default."    },    "allow_provider_key_direct_routes": {      "type": "boolean",      "description": "Whether the account's saved provider keys (for example an Anthropic key) may call their provider directly although the project states no tier. On, the default EU-resident floor does not apply to those routes, which may be served outside the EU; Veryfront's own routes keep it, and every requirement the project states (a tier, jurisdictions, hosts, models, precision) still applies. Saving a key alone never relaxes the policy. False when never set."    },    "account": {      "type": [        "object",        "null"      ],      "properties": {        "models": {          "type": "object",          "properties": {            "allowed": {              "type": [                "array",                "null"              ],              "items": {                "type": "string"              },              "description": "Canonical model IDs that may be used. Null means no restriction; an empty list allows nothing."            },            "denied": {              "type": "array",              "items": {                "type": "string"              },              "description": "Canonical model IDs that may not be used. A denial overrides an allowance; an empty list denies nothing."            }          },          "required": [            "allowed",            "denied"          ]        },        "default_model": {          "type": [            "string",            "null"          ],          "description": "Default model ID. Null uses the built-in default, mistral/mistral-small-2503. A project default wins over the account default."        }      },      "required": [        "models",        "default_model"      ],      "description": "The policy the project inherits from its account: its models and default_model. Null for a project without an account."    },    "effective": {      "type": "object",      "properties": {        "models": {          "type": "object",          "properties": {            "allowed": {              "type": [                "array",                "null"              ],              "items": {                "type": "string"              },              "description": "Canonical model IDs that may be used. Null means no restriction; an empty list allows nothing."            },            "denied": {              "type": "array",              "items": {                "type": "string"              },              "description": "Canonical model IDs that may not be used. A denial overrides an allowance; an empty list denies nothing."            }          },          "required": [            "allowed",            "denied"          ]        },        "default_model": {          "type": [            "string",            "null"          ],          "description": "The model a call naming none gets: the project default, then the account default, then the built-in default, the first one allowed and served under the project's whole policy. Null when none is. A customer-funded default still needs a usable credential at run time. Project members can read this default through `GET /ai/models` deployments[].is_policy_default without settings access; API-key limits may narrow that discovery answer further."        }      },      "required": [        "models",        "default_model"      ],      "description": "What applies to the project: its own and its account's rules composed (allowed lists intersect, denied lists combine), and the default model a call naming none gets."    }  },  "required": [    "project_id",    "configured",    "enforced",    "created_at",    "updated_at",    "updated_by",    "models",    "default_model",    "allow_provider_key_direct_routes",    "account",    "effective"  ]}

components/schemas/Problem

JSON
{  "type": "object",  "properties": {    "cause": {      "type": "string",      "enum": [        "schedule_concurrency_forbidden",        "schedule_fire_in_progress",        "schedule_run_limit_reached"      ],      "description": "Schedule admission refusal."    },    "idempotency": {      "type": "object",      "properties": {        "state": {          "type": "string",          "enum": [            "in_progress",            "payload_mismatch",            "outcome_unknown"          ]        },        "operation": {          "type": "string",          "minLength": 1        },        "retryable": {          "type": "boolean"        },        "retry_after_seconds": {          "type": [            "integer",            "null"          ],          "minimum": 0        },        "expires_at": {          "type": [            "string",            "null"          ]        },        "recovery": {          "type": "object",          "properties": {            "available": {              "type": "boolean"            },            "description": {              "type": "string"            },            "resource_url": {              "type": "string"            }          },          "required": [            "available",            "description"          ]        }      },      "required": [        "state",        "operation",        "retryable",        "retry_after_seconds",        "expires_at"      ],      "description": "Replay status, retry timing, and recovery lookup."    },    "type": {      "type": "string",      "description": "URI reference identifying the problem type",      "example": "https://api.veryfront.com/errors/validation-failed"    },    "title": {      "type": "string",      "description": "Short human-readable summary of the problem",      "example": "Validation Failed"    },    "status": {      "type": "integer",      "minimum": 100,      "maximum": 599,      "description": "HTTP status code",      "example": 400    },    "code": {      "type": "string",      "description": "Stable machine-readable error code",      "example": "RUN_INVALID_INPUT"    },    "detail": {      "type": "string",      "description": "Human-readable explanation specific to this occurrence",      "example": "The 'email' field must be a valid email address"    },    "instance": {      "type": "string",      "description": "URI reference identifying the specific occurrence",      "example": "/projects/my-project/members"    },    "slug": {      "type": "string",      "description": "Stable identifier for the problem type",      "example": "validation-failed"    },    "category": {      "type": "string",      "enum": [        "AUTH",        "RESOURCE",        "VALIDATION",        "DATABASE",        "SUBSCRIPTION",        "INTEGRATION",        "INTERNAL"      ],      "description": "API error category",      "example": "VALIDATION"    },    "suggestion": {      "type": "string",      "description": "Suggested action to resolve the problem",      "example": "Check the request body and query parameters against the API documentation."    },    "errors": {      "type": "array",      "items": {        "type": "object",        "properties": {          "field": {            "type": "string",            "description": "Field path that caused the error",            "example": "email"          },          "message": {            "type": "string",            "description": "Error message for this field",            "example": "Invalid email format"          },          "code": {            "type": "string",            "description": "Error code for this field",            "example": "INVALID_FORMAT"          }        },        "required": [          "field",          "message"        ]      },      "description": "Detailed field-level errors for validation failures"    }  },  "required": [    "type",    "title",    "status"  ]}

Operation contract

JSON
{  "operationId": "patchInferencePolicy",  "tags": [    "ai-gateway/Models/Project inference policy"  ],  "summary": "Update inference policy models",  "description": "Update the models a project allows and denies and its default model, replacing each key sent; returns the policy. Requires project.settings.manage.",  "parameters": [    {      "$ref": "#/components/parameters/ProjectReference"    }  ],  "requestBody": {    "required": true,    "content": {      "application/json": {        "schema": {          "type": "object",          "properties": {            "models": {              "type": "object",              "properties": {                "allowed": {                  "type": [                    "array",                    "null"                  ],                  "items": {                    "type": "string",                    "minLength": 1,                    "maxLength": 200,                    "pattern": "^[a-z0-9][a-z0-9._/-]*$",                    "description": "Model ID returned by list_models. Known catalog aliases are normalized to canonical IDs. Policy IDs use letters, digits, dots, underscores, slashes, and hyphens; arbitrary provider model strings are not accepted."                  },                  "maxItems": 500,                  "description": "Model IDs from list_models the project allows. Null removes the restriction; an empty list allows nothing. Omit to keep the stored list."                },                "denied": {                  "type": "array",                  "items": {                    "type": "string",                    "minLength": 1,                    "maxLength": 200,                    "pattern": "^[a-z0-9][a-z0-9._/-]*$",                    "description": "Model ID returned by list_models. Known catalog aliases are normalized to canonical IDs. Policy IDs use letters, digits, dots, underscores, slashes, and hyphens; arbitrary provider model strings are not accepted."                  },                  "maxItems": 500,                  "description": "Model IDs from list_models the project denies. A denial overrides an allowance. Omit to keep the stored list."                }              },              "additionalProperties": false,              "description": "Models the project allows and denies. They only narrow what its account allows."            },            "default_model": {              "type": [                "string",                "null"              ],              "minLength": 1,              "maxLength": 200,              "pattern": "^[a-z0-9][a-z0-9._/-]*$",              "description": "Default model of the project. It must be allowed by the project's and its account's policy. Null uses the account default. Omit to keep the stored value."            },            "allow_provider_key_direct_routes": {              "type": "boolean",              "description": "Whether the account's saved provider keys (for example an Anthropic key) may call their provider directly although the project states no tier. On, the default EU-resident floor does not apply to those routes, which may be served outside the EU; Veryfront's own routes keep it, and every requirement the project states (a tier, jurisdictions, hosts, models, precision) still applies. Saving a key alone never relaxes the policy. Omit to keep the stored value."            }          },          "additionalProperties": false        }      }    }  },  "responses": {    "200": {      "description": "The policy as it now stands",      "content": {        "application/json": {          "schema": {            "$ref": "#/components/schemas/InferencePolicy"          }        }      }    },    "400": {      "description": "Bad request",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "401": {      "description": "Unauthorized",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "403": {      "description": "Requires a signed-in project administrator. API keys are rejected regardless of their scopes, including project-scoped keys.",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "404": {      "description": "Not found",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "422": {      "description": "A model in `models.allowed` or `default_model` is retired (`model-retired`). The Problem detail names its successor; nothing is saved.",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    },    "500": {      "description": "Server error",      "content": {        "application/problem+json": {          "schema": {            "$ref": "#/components/schemas/Problem"          }        }      }    }  },  "x-documentation-source-tag": "Project inference policy",  "x-canonical-documentation": {    "domain": "ai-gateway",    "resource": "Models",    "subgroup": "Project inference policy",    "name": "Update inference policy models",    "description": "Update the models a project allows and denies and its default model, replacing each key sent; returns the policy. Requires project.settings.manage.",    "operationId": "patchInferencePolicy"  },  "x-mint": {    "href": "/cloud/rest/api-reference/ai-gateway-models-project-inference-policy/update-inference-policy-models"  }}