Vertex AI PayGo and Priority

Vertex AI PayGo and Priority

Priority PayGo

LiteLLM은 Priority PayGo를 지원합니다.

priority 헤더를 보내면 priority 큐잉을 받고 priority 토큰 요금을 지불할 수 있어요.

어떤 모델이 Priority PayGo를 지원하나요? 이 글 작성 시점: gemini/gemini-2.5-pro, vertex_ai/gemini-3-pro-preview, vertex_ai/gemini-3.1-pro-preview, vertex_ai/gemini-3-flash-preview 및 그 변형들입니다. LiteLLM의 모델 가격 JSON에서 supports_service_tier: true를 확인하세요.

priority 요청 보내기

다음 헤더를 사용하세요:

X-Vertex-AI-LLM-Shared-Request-Type: priority

  • LiteLLM SDK
  • Proxy config
  • Pass-through mode
import litellmresponse = litellm.completion(
    model="vertex_ai/gemini-3.1-pro-preview",
    messages=[{"role": "user", "content": "Summarize the Gettysburg Address."}],
    vertex_project="YOUR_PROJECT_ID",
    vertex_location="us-central1",
    extra_headers={"X-Vertex-AI-LLM-Shared-Request-Type": "priority"},)print(response.choices[0].message.content)

config.yaml

model_list:
  - model_name: gemini-priority
    litellm_params:
      model: vertex_ai/gemini-3.1-pro-preview
      vertex_project: "YOUR_PROJECT_ID"
      vertex_location: "us-central1"
      vertex_credentials: os.environ/GOOGLE_APPLICATION_CREDENTIALS
      extra_headers:
        X-Vertex-AI-LLM-Shared-Request-Type: priority
curl http://localhost:4000/v1/chat/completions \
  -H "Authorization: Bearer ***" \
  -H "Content-Type: application/json" \
  -d '{"model": "gemini-priority", "messages": [{"role": "user", "content": "Hello"}]}'

LiteLLM이 제공자별 헤더를 전달하도록 x-pass-를 사용하세요.

MODEL_ID="gemini-3.1-pro-preview"PROJECT_ID="YOUR_PROJECT_ID"curl -X POST \
  "${LITELLM_PROXY_BASE_URL}/vertex_ai/v1/projects/${PROJECT_ID}/locations/global/publishers/google/models/${MODEL_ID}:generateContent" \
  -H "Authorization: Bearer ***" \
  -H "Content-Type: application/json" \
  -H "x-pass-X-Vertex-AI-LLM-Shared-Request-Type: priority" \
  -d '{"contents": [{"role": "user", "parts": [{"text": "Hello!"}]}]}'

비용 추적이 동작하는 방식

trafficTypeservice_tier 매핑

| usageMetadata.trafficType | service_tier | Pricing keys used | | ON_DEMAND | None | input_cost_per_token | | ON_DEMAND_PRIORITY | "priority" | input_cost_per_token_priority | | FLEX / BATCH | "flex" | input_cost_per_token_flex |

tier별 키가 없으면 LiteLLM은 표준 가격 키로 폴백합니다.

Standard PayGo vs Provisioned Throughput

이것은 priority 라우팅과는 다른 헤더입니다:

| Header value | Behavior | | X-Vertex-AI-LLM-Request-Type: shared | Force standard PayGo (bypass PT) | | X-Vertex-AI-LLM-Request-Type: dedicated | Force Provisioned Throughput only (429 if exhausted) |

네이티브 라우트 예시

import litellmresponse = litellm.completion(
    model="vertex_ai/gemini-3.8-flash",
    messages=[{"role": "user", "content": "Hello!"}],
    vertex_project="YOUR_PROJECT_ID",
    vertex_location="us-central1",
    extra_headers={"X-Vertex-AI-LLM-Request-Type": "shared"},)

Pass-through 예시

MODEL_ID="gemini-3.8-flash"PROJECT_ID="YOUR_PROJECT_ID"curl -X POST \
  "${LITELLM_PROXY_BASE_URL}/vertex_ai/v1/projects/${PROJECT_ID}/locations/global/publishers/google/models/${MODEL_ID}:generateContent" \
  -H "Authorization: Bearer ***" \
  -H "Content-Type: application/json" \
  -H "x-pass-X-Vertex-AI-LLM-Request-Type: shared" \
  -d '{
    "contents": [{"role": "user", "parts": [{"text": "Hello!"}]}]
  }'

트러블슈팅

Q: 403 Permission denied 또는 IAM_PERMISSION_DENIED는 무엇을 의미하나요?

A: 서비스 계정 또는 Application Default Credentials(ADC) 사용자에게 roles/aiplatform.user 역할이 없어요. 이 문제를 해결하려면 gcloud projects add-iam-policy-binding을 다시 실행하세요.

Q: 429 Quota exceeded 오류가 나면 어떻게 해야 하나요?

A: 리전별 QPM(분당 쿼리) 또는 TPM(분당 토큰) 할당량에 도달했다는 뜻이에요. 다음을 할 수 있어요:

  • GCP Quotas 콘솔에서 할당량 증가를 요청
  • 로드 밸런싱을 위해 LiteLLM 구성에 리전 추가
  • 보장 용량을 위해 Provisioned Throughput으로 업그레이드

Q: VERTEXAI_PROJECT not set 오류는 어떻게 고치나요?

A: LiteLLM 호출에서 vertex_project 파라미터를 명시적으로 전달하거나, 코드를 실행하기 전에 VERTEXAI_PROJECT 환경 변수를 설정하세요.

더 알아보기 (Learn more)