POST /ai/gateway/billing/finalizeFinalize gateway billing group.
Servers
[
{
"url": "https://api.veryfront.com"
}
]Authentication
[
{
"bearerAuth": []
},
{
"apiKeyAuth": []
}
]{
"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
Parameter contracts
[
{
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Canonical project selector: a UUID or slug for model access, inference and billing context. A signed project scope takes precedence. Otherwise, send only one project selector header."
},
"required": false,
"name": "x-veryfront-project-reference",
"in": "header"
},
{
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Compatibility selector accepting a project UUID. Prefer x-veryfront-project-reference."
},
"required": false,
"name": "x-veryfront-project-id",
"in": "header"
},
{
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Compatibility selector accepting a project slug. Prefer x-veryfront-project-reference."
},
"required": false,
"name": "x-veryfront-project-slug",
"in": "header"
}
]Request body
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GatewayBillingGroupFinalizeRequest"
}
}
}
}Responses
200
Direct gateway charges for the user-facing billing group, reconciled from server-recorded usage
{
"description": "Direct gateway charges for the user-facing billing group, reconciled from server-recorded usage",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GatewayBillingGroupFinalizeResponse"
}
}
}
}400
Invalid billing group request
{
"description": "Invalid billing group request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}401
Unauthorized
{
"description": "Unauthorized",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}402
Insufficient AI credits for reconciliation
{
"description": "Insufficient AI credits for reconciliation",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/CreditProblem"
}
}
}
}403
Project access denied
{
"description": "Project access denied",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}404
Billing group not found
{
"description": "Billing group not found",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}409
Billing group usage is not ready to finalize
{
"description": "Billing group usage is not ready to finalize",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}Referenced contracts
components/schemas/GatewayBillingGroupFinalizeRequest
{
"type": "object",
"properties": {
"billing_group_id": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^[A-Za-z0-9._:-]+$"
}
},
"required": [
"billing_group_id"
]
}components/schemas/GatewayBillingGroupFinalizeResponse
{
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"enum": [
true
]
},
"funding": {
"type": "string",
"enum": [
"customer",
"mixed"
]
},
"billing_group_id": {
"type": "string"
},
"already_finalized": {
"type": "boolean"
},
"request_count": {
"type": "integer",
"minimum": 0
},
"charged_credits": {
"type": "number",
"minimum": 0
},
"target_credits": {
"type": "number",
"minimum": 0
},
"adjustment_credits": {
"type": "number",
"minimum": 0
},
"adjustment": {
"type": "string",
"enum": [
"none",
"refund",
"spend"
]
},
"provider_cost_usd": {
"type": "number",
"minimum": 0
},
"veryfront_charge_usd": {
"type": "number",
"minimum": 0
},
"veryfront_billed_usd": {
"type": "number",
"minimum": 0
},
"usage_capture_status": {
"type": "string",
"enum": [
"complete",
"partial",
"missing"
]
}
},
"required": [
"ok",
"billing_group_id",
"already_finalized",
"request_count",
"charged_credits",
"target_credits",
"adjustment_credits",
"adjustment",
"provider_cost_usd",
"veryfront_charge_usd",
"veryfront_billed_usd",
"usage_capture_status"
]
}components/schemas/Problem
{
"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"
]
}components/schemas/CreditProblem
{
"allOf": [
{
"$ref": "#/components/schemas/Problem"
},
{
"type": "object",
"properties": {
"balance": {
"type": "number",
"description": "Current credit balance"
},
"required": {
"type": "number",
"description": "Credits required for this request"
}
},
"required": [
"balance",
"required"
]
}
]
}Operation contract
{
"summary": "Finalize gateway billing group",
"description": "Finalize gateway billing group.",
"operationId": "finalizeGatewayBillingGroup",
"tags": [
"ai-gateway/Inference/Provider gateway"
],
"parameters": [
{
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Canonical project selector: a UUID or slug for model access, inference and billing context. A signed project scope takes precedence. Otherwise, send only one project selector header."
},
"required": false,
"name": "x-veryfront-project-reference",
"in": "header"
},
{
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Compatibility selector accepting a project UUID. Prefer x-veryfront-project-reference."
},
"required": false,
"name": "x-veryfront-project-id",
"in": "header"
},
{
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"description": "Compatibility selector accepting a project slug. Prefer x-veryfront-project-reference."
},
"required": false,
"name": "x-veryfront-project-slug",
"in": "header"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GatewayBillingGroupFinalizeRequest"
}
}
}
},
"responses": {
"200": {
"description": "Direct gateway charges for the user-facing billing group, reconciled from server-recorded usage",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GatewayBillingGroupFinalizeResponse"
}
}
}
},
"400": {
"description": "Invalid billing group request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
},
"402": {
"description": "Insufficient AI credits for reconciliation",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/CreditProblem"
}
}
}
},
"403": {
"description": "Project access denied",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
},
"404": {
"description": "Billing group not found",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
},
"409": {
"description": "Billing group usage is not ready to finalize",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}
},
"x-documentation-source-tag": "Provider gateway",
"x-canonical-documentation": {
"domain": "ai-gateway",
"resource": "Inference",
"subgroup": "Provider gateway",
"name": "Finalize gateway billing group",
"description": "Finalize gateway billing group.",
"operationId": "finalizeGatewayBillingGroup"
},
"x-mint": {
"href": "/cloud/rest/api-reference/ai-gateway-inference-provider-gateway/finalize-gateway-billing-group"
}
}