Skip to documentation
DEVELOPER DOCS / HASHBIDXMODEL ACCESS. ONE INTEGRATION.

Gemini relay

Gemini generateContent

Pass-through to Google Gemini's native API, supporting generateContent, streamGenerateContent, and countTokens (estimated locally). Useful for SDKs and tools that speak the Gemini wire format, such as Gemini CLI. Authenticate with the Authorization: Bearer or x-goog-api-key header; a key in the key query parameter is rejected.

POST/v1/gemini/v1beta/models/{model}:generateContent

Key request parameters

ParameterTypeDescription
modelstring · Required (path)Gemini model identifier, e.g. gemini-3-pro-image-preview
contentsContent[] · RequiredConversation contents with role + parts
contents[].rolestringuser or model
contents[].partsPart[]Ordered parts — text, inline_data, file_data, etc.
contents[].parts[].textstringText content of a part
generationConfigobjectSampling and output shaping
generationConfig.responseModalitiesstring[]e.g. ["TEXT","IMAGE"]
generationConfig.imageConfig.aspectRatiostringe.g. 16:9
generationConfig.imageConfig.imageSizestringe.g. 4K

Key response parameters

ParameterTypeDescription
candidatesCandidate[]Generated candidates
candidates[].content.rolestringAlways model
candidates[].content.partsPart[]Generated parts (text and/or inline image data)
candidates[].finishReasonstringSTOP, MAX_TOKENS, SAFETY, etc.
candidates[].safetyRatingsRating[]Per-category safety ratings
usageMetadata.promptTokenCountintegerTokens in the prompt
usageMetadata.candidatesTokenCountintegerTokens generated
usageMetadata.totalTokenCountintegerSum

Integration examples

Replace the API key and model ID in these examples with your values.

cURL
cURL
curl https://hashbidx.ai/v1/gemini/v1beta/models/gemini-3-pro-image-preview:generateContent \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"role":"user","parts":[{"text":"draw a cat"}]}],
    "generationConfig": {
      "responseModalities": ["TEXT","IMAGE"],
      "imageConfig": {"aspectRatio":"16:9","imageSize":"4K"}
    }
  }'
Python
Python
import httpx

resp = httpx.post(
    "https://hashbidx.ai/v1/gemini/v1beta/models/gemini-3-pro-image-preview:generateContent",
    headers={"Authorization": "Bearer <YOUR_API_KEY>"},
    json={
        "contents": [{"role": "user", "parts": [{"text": "draw a cat"}]}],
        "generationConfig": {
            "responseModalities": ["TEXT", "IMAGE"],
            "imageConfig": {"aspectRatio": "16:9", "imageSize": "4K"},
        },
    },
)
resp.raise_for_status()
print(resp.json())
Node.js
Node.js
const resp = await fetch(
  "https://hashbidx.ai/v1/gemini/v1beta/models/gemini-3-pro-image-preview:generateContent",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer <YOUR_API_KEY>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      contents: [{ role: "user", parts: [{ text: "draw a cat" }] }],
      generationConfig: {
        responseModalities: ["TEXT", "IMAGE"],
        imageConfig: { aspectRatio: "16:9", imageSize: "4K" },
      },
    }),
  },
);
console.log(await resp.json());
Go
Go
body, _ := json.Marshal(map[string]any{
  "contents": []map[string]any{{
    "role":  "user",
    "parts": []map[string]any{{"text": "draw a cat"}},
  }},
  "generationConfig": map[string]any{
    "responseModalities": []string{"TEXT", "IMAGE"},
    "imageConfig": map[string]any{
      "aspectRatio": "16:9",
      "imageSize":   "4K",
    },
  },
})
req, _ := http.NewRequest("POST",
  "https://hashbidx.ai/v1/gemini/v1beta/models/gemini-3-pro-image-preview:generateContent",
  bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer <YOUR_API_KEY>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
Rust
Rust
let body = serde_json::json!({
    "contents": [{"role": "user", "parts": [{"text": "draw a cat"}]}],
    "generationConfig": {
        "responseModalities": ["TEXT", "IMAGE"],
        "imageConfig": {"aspectRatio": "16:9", "imageSize": "4K"},
    },
});
let resp = reqwest::Client::new()
    .post("https://hashbidx.ai/v1/gemini/v1beta/models/gemini-3-pro-image-preview:generateContent")
    .bearer_auth("<YOUR_API_KEY>")
    .json(&body)
    .send().await?;

If the response includes X-Request-Id, include it when troubleshooting an issue.

All API endpoints
BUILD WITH HASHBIDX

Find your model. Make your first call.

Models & pricing