Gemini API Access & Pricing:
Fix User Location Not Supported via v1beta

Fix Google AI Studio 400 User location is not supported and call native Gemini v1beta API (Gemini 4 Hydrogen from ¥1.20 CNY / 1M) with Google Gen AI SDK & Gemini CLI.

Updated 3 min read

On this page(4)
  1. Why Native v1beta Beats the OpenAI Compatibility Layer
  2. Gemini Lineup & Pricing on Brioi
  3. Endpoints, Auth & Code Examples
  4. Troubleshooting

Requests to generativelanguage.googleapis.com from unsupported regions fail with 400 FAILED_PRECONDITION: User location is not supported for the API use, and Google Cloud billing often declines local cards. Through Brioi’s native Google v1beta endpoint, set base_url to https://vip.brioi.com (omit /v1beta) with your Brioi API key and pay in USDT (TRC20 / BEP20 / Solana) or card. gemini-4-hydrogen starts from ¥1.20 CNY per 1M input tokens and from ¥6.00 CNY per 1M output tokens, while gemini-3.8-flash starts from ¥0.60 CNY per 1M input tokens (as of 2026-12-04; see live routes on the pricing page).

Verified against Brioi Native Gemini Text API Docs and Google Gemini API Reference (2026-12).

Why Native v1beta Beats the OpenAI Compatibility Layer

Capability Native Gemini (v1beta/...:generateContent) OpenAI Wrapper (/v1/chat/completions)
Reasoning controls (thinkingConfig, thoughtSignature) Preserved end-to-end across turns Gemini-specific fields may be dropped
Strict JSON output (responseSchema) Enforced natively Schema enforcement not guaranteed
Multimodal inputs (inlineData, fileData) Full native parts[] support Limited mapping
Official google-genai SDK & Gemini CLI One-line base_url override Incompatible

Gemini Lineup & Pricing on Brioi

Starting prices on one shared balance (as of 2026-12-04; text model rates depend on route on the pricing page):

Model ID Billing Unit Typical Use Brioi Price
gemini-4-carbon Per 1M tokens Deep repo analysis & multimodal reasoning in from ¥3.20 CNY / out from ¥16.00 CNY
gemini-4-hydrogen Per 1M tokens Production chat, long context & extraction (Gemini 4 API) in from ¥1.20 CNY / out from ¥6.00 CNY
gemini-3.8-flash Per 1M tokens Low-latency agents & high-volume pipelines in from ¥0.60 CNY / out from ¥3.00 CNY
gemini-3.1-flash-lite Per 1M tokens Bulk classification, tagging, translation in from ¥0.20 CNY / out from ¥1.20 CNY
gemini-3.1-flash-image Per image Product visuals (Nano Banana API) ¥0.22 CNY / image
gemini-3.8-flash-tts Per request Multi-speaker TTS (Gemini TTS API) ¥0.072 CNY / call

Endpoints, Auth & Code Examples

  • Sync: POST https://vip.brioi.com/v1beta/models/{model}:generateContent
  • SSE stream: POST https://vip.brioi.com/v1beta/models/{model}:streamGenerateContent?alt=sse
  • Models: GET https://vip.brioi.com/v1beta/models
  • Auth: x-goog-api-key: YOUR_API_KEY (default), Authorization: Bearer YOUR_API_KEY, or ?key=YOUR_API_KEY.

cURL with Strict responseSchema

curl -X POST "https://vip.brioi.com/v1beta/models/gemini-4-hydrogen:generateContent" \
  -H "x-goog-api-key: $BRIOI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"role": "user", "parts": [{"text": "Extract city and event: Hardware summit in Berlin next Tuesday"}]}],
    "generationConfig": {
      "responseMimeType": "application/json",
      "responseSchema": {
        "type": "object",
        "properties": {"city": {"type": "string"}, "event": {"type": "string"}},
        "required": ["city", "event"]
      }
    }
  }'

Skip parts[] entries marked "thought": true when assembling the final answer; reasoning tokens appear in usageMetadata.thoughtsTokenCount.

Python (google-genai) & TypeScript (@google/genai)

import os
from google import genai

client = genai.Client(
    api_key=os.environ["BRIOI_API_KEY"],
    http_options={"base_url": "https://vip.brioi.com"},
)
resp = client.models.generate_content(model="gemini-4-carbon", contents="Explain inverted indexes in one sentence")
print(resp.text)

Gemini CLI Setup

export GEMINI_API_KEY="YOUR_API_KEY"
export GOOGLE_GEMINI_BASE_URL="https://vip.brioi.com"
gemini -m gemini-4-carbon

If non-interactive runs report Invalid auth method selected., write {"security": {"auth": {"selectedType": "gemini-api-key"}}} to ~/.gemini/settings.json.

Troubleshooting

  • 401: Pass your Brioi API key rather than a Google AIza... key.
  • 400 Request contains an invalid argument: Remove unsupported optional fields and test with contents first.
  • :countTokens returns 404: Read token usage from usageMetadata in generation responses instead.

See Native Gemini API Docs and Developer Tools.