How to Use Gemini 3 Flash
Gemini 3 Flash offers two endpoints — standard async and live streaming.
Standard (Async) — POST /api/v1/gemini-flash
Use for workflows, automation, and batch processing.
Python:
import requests, time
API_KEY = "your_api_key_here"
headers = {"x-api-key": API_KEY, "Content-Type": "application/json"}
# 1. Submit
r = requests.post("https://api.muapi.ai/api/v1/gemini-flash", headers=headers,
json={"prompt": "Explain quantum computing.", "system_prompt": "Be concise."})
request_id = r.json()["request_id"]
# 2. Poll
while True:
result = requests.get(f"https://api.muapi.ai/api/v1/predictions/{request_id}/result", headers=headers).json()
if result["status"] == "completed":
print(result["output"]["text"])
break
time.sleep(2)
cURL:
# Submit
curl -X POST https://api.muapi.ai/api/v1/gemini-flash \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"prompt": "Explain quantum computing."}'
# Poll
curl https://api.muapi.ai/api/v1/predictions/{request_id}/result \
-H "x-api-key: YOUR_API_KEY"
Streaming (SSE) — POST /api/v1/gemini-flash/stream
Use for chat UIs and real-time token display.
Python (httpx):
import httpx, json
API_KEY = "your_api_key_here"
with httpx.Client(timeout=120) as client:
with client.stream("POST", "https://api.muapi.ai/api/v1/gemini-flash/stream",
headers={"x-api-key": API_KEY, "Content-Type": "application/json"},
json={"prompt": "Write a poem about the ocean."}
) as response:
for line in response.iter_lines():
if line.startswith("data: "):
data = line[6:]
if data == "[DONE]": break
delta = json.loads(data)["choices"][0]["delta"].get("content", "")
if delta: print(delta, end="", flush=True)
print()
JavaScript (fetch):
const response = await fetch("https://api.muapi.ai/api/v1/gemini-flash/stream", {
method: "POST",
headers: { "x-api-key": "YOUR_API_KEY", "Content-Type": "application/json" },
body: JSON.stringify({ prompt: "Write a poem about the ocean." })
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
for (const line of decoder.decode(value, { stream: true }).split("\n")) {
if (!line.startsWith("data: ")) continue;
const data = line.slice(6).trim();
if (data === "[DONE]") return;
const delta = JSON.parse(data).choices?.[0]?.delta?.content ?? "";
if (delta) process.stdout.write(delta);
}
}
cURL:
curl -X POST https://api.muapi.ai/api/v1/gemini-flash/stream \
-H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"prompt": "Write a poem about the ocean."}' --no-buffer
See full documentation at /docs/streaming.
Token-Based Pricing
| Token Type | Rate |
|---|
| Input | $0.30 per million |
| Output | $1.80 per million |
A minimum wallet balance of $1.00 is required.