Compatible with Google Generative Language API spec (Gemini / Veo / Lyria). Authenticate with an x-goog-api-key: YOUR_API_KEY or Authorization: Bearer YOUR_API_KEY header (never place keys in URL query strings; ?key= query authentication is disabled — the official Google SDK uses the header by default).
POST https://www.myai168.com/en/api/google/v1beta/models/{model}:generateContentGemini chat (non-streaming).
curl "https://www.myai168.com/en/api/google/v1beta/models/gemini-3.1-pro-preview:generateContent" \
-H "x-goog-api-key: YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/google/v1beta/models/gemini-3.1-pro-preview:generateContent",
headers={"x-goog-api-key": "YOUR_DEV_KEY"},
json={"contents": [{"parts": [{"text": "Hello"}]}]},
)
print(r.json())
POST https://www.myai168.com/en/api/google/v1beta/models/{model}:streamGenerateContentGemini chat (SSE streaming). This relay always returns SSE (the server enforces alt=sse toward the upstream), so unlike calling the official Google API directly you do not need to add ?alt=sse to the URL (it is ignored if present).
curl "https://www.myai168.com/en/api/google/v1beta/models/gemini-3.1-pro-preview:streamGenerateContent" \
-H "x-goog-api-key: YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/google/v1beta/models/gemini-3.1-pro-preview:streamGenerateContent",
headers={"x-goog-api-key": "YOUR_DEV_KEY"},
json={"contents": [{"parts": [{"text": "Hello"}]}]},
stream=True,
)
for line in r.iter_lines():
if line:
print(line.decode("utf-8"))
POST https://www.myai168.com/en/api/google/v1beta/models/gemini-3-pro-image-preview:generateContentNano Banana Pro text-to-image (Gemini multimodal, returns inline_data base64 image).
curl "https://www.myai168.com/en/api/google/v1beta/models/gemini-3-pro-image-preview:generateContent" \
-H "x-goog-api-key: YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"A cat"}]}],"generationConfig":{"responseModalities":["TEXT","IMAGE"]}}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/google/v1beta/models/gemini-3-pro-image-preview:generateContent",
headers={"x-goog-api-key": "YOUR_DEV_KEY"},
json={"contents": [{"parts": [{"text": "A cat"}]}], "generationConfig": {"responseModalities": ["TEXT", "IMAGE"]}},
)
print(r.json())
POST https://www.myai168.com/en/api/google/v1beta/models/veo-{ver}:predictLongRunningVeo video generation (LRO; first call returns operation name, poll for result).
curl "https://www.myai168.com/en/api/google/v1beta/models/veo-3.1-generate-preview:predictLongRunning" \
-H "x-goog-api-key: YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"instances":[{"prompt":"A cat dancing"}],"parameters":{"durationSeconds":8}}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/google/v1beta/models/veo-3.1-generate-preview:predictLongRunning",
headers={"x-goog-api-key": "YOUR_DEV_KEY"},
json={"instances": [{"prompt": "A cat dancing"}], "parameters": {"durationSeconds": 8}},
)
print(r.json())
POST https://www.myai168.com/en/api/google/v1beta/models/lyria-{ver}:predictLyria music generation (returns base64 audio). Note: Google has moved Gemini API music generation to Lyria 3 (lyria-3-clip-preview / lyria-3-pro-preview via the new Interactions API), and the official docs no longer list the lyria-002 :predict interface — this relay keeps forwarding the legacy interface; if the upstream has dropped it you will get an upstream error (no credits deducted). Check Google's official announcements for availability.
curl "https://www.myai168.com/en/api/google/v1beta/models/lyria-002:predict" \
-H "x-goog-api-key: YOUR_DEV_KEY" \
-H "Content-Type: application/json" \
-d '{"instances":[{"prompt":"Upbeat jazz"}],"parameters":{"sampleCount":1}}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/google/v1beta/models/lyria-002:predict",
headers={"x-goog-api-key": "YOUR_DEV_KEY"},
json={"instances": [{"prompt": "Upbeat jazz"}], "parameters": {"sampleCount": 1}},
)
print(r.json())
GET https://www.myai168.com/en/api/google/v1beta/operations/{name}Query LRO operation status (used for Veo poll, query endpoint, no credits deducted).
curl "https://www.myai168.com/en/api/google/v1beta/operations/OP_NAME" \
-H "x-goog-api-key: YOUR_DEV_KEY"
import requests
r = requests.get(
"https://www.myai168.com/en/api/google/v1beta/operations/OP_NAME",
headers={"x-goog-api-key": "YOUR_DEV_KEY"},
)
print(r.json())
The request body is JSON, identical to the official Google spec. Authenticate with an x-goog-api-key or Authorization: Bearer header.
| Parameter | Type | Required | Description |
|---|---|---|---|
contents | array | required | Conversation contents, each {"role": "user" | "model", "parts": [{"text": "..."}]}; parts may also contain inline_data (base64 image / audio). |
generationConfig | object | optional | Temperature, output limits, responseModalities (image models need ["TEXT","IMAGE"]) and other official settings. |
systemInstruction | object | optional | System prompt (official spec). |
tools | array | optional | Official tool settings forwarded as-is (Google Search grounding is billed per use). |
The model id goes in the URL path (models/{model}:generateContent); models not in the pricing table return "No pricing info! Please use other models!". Veo uses instances + parameters (durationSeconds / numberOfVideos / resolution) and Lyria uses instances + parameters.sampleCount (see the examples above).
Non-streaming: official JSON — text in candidates[0].content.parts[], usage in usageMetadata; response headers include X-Cost-Points (points charged) and X-Credits-Remaining (balance after the call). Streaming (:streamGenerateContent) is SSE; after the stream ends, SSE comment lines : cost=N / : credits-remaining=M carry the points charged and remaining balance. You can also query GET https://www.myai168.com/en/api/user/get_credits any time.
| HTTP status | Meaning |
|---|---|
401 | Missing or invalid API key (repeated failures from the same IP are temporarily blocked). |
402 | Insufficient credits (please top up). |
400 | Invalid request body, or model not in the supported list ("No pricing info! Please use other models!"). |
502 | Upstream vendor error — never charged. |
No points are ever charged on errors (including when the vendor returns no usage info); polling LRO status (operations) is free.