GenAI Integration

Create cached content (Gemini format)

Creates a cached content entry that can be re-used across subsequent generate-content calls to reduce repeated prefix tokens.

POST
/genai/v1beta/cachedContents
AuthorizationBearer <token>

Bearer token authentication. Use your MPilot virtual-key JWT or admin JWT. Virtual keys (prefixed with sk-bf-) can also be passed here.

In: header

Header Parameters

x-model-provider?string

Optional provider override. Defaults to gemini. Use vertex to route to Vertex.

modelstring

Gemini model identifier (e.g. gemini-1.5-pro). The models/ prefix is stripped.

displayName?string
systemInstruction?object

System instruction content.

Empty Object

contents?array<unknown>
tools?array<unknown>
toolConfig?unknown
ttl?string

TTL in protobuf duration format (e.g. 3600s).

expireTime?string
Formatdate-time
[key: string]any

Response Body

curl -X POST "https://loading/{AI_GATEWAY_URL}/genai/v1beta/cachedContents" \  -H "x-model-provider: string" \  -H "Content-Type: application/json" \  -d '{    "model": "string"  }'
{}
{
  "error": {
    "code": 0,
    "message": "string",
    "status": "string",
    "details": [
      {
        "@type": "string",
        "fieldViolations": [
          {
            "description": "string"
          }
        ]
      }
    ]
  }
}
{
  "error": {
    "code": 0,
    "message": "string",
    "status": "string",
    "details": [
      {
        "@type": "string",
        "fieldViolations": [
          {
            "description": "string"
          }
        ]
      }
    ]
  }
}
On this page

On this page

No Headings