Google - Format

Base-Path:

https://api.hyprlab.io

Non-Stream Path:

https://api.hyprlab.io/v1beta/models/[MODEL]:generateContent?key=[API-KEY]

Stream Path:

https://api.hyprlab.io/v1beta/models/[MODEL]:streamGenerateContent?alt=sse&key=[API-KEY]

Sample API Request

Basic Request:

= = =

Curl:

= = =

curl -X POST "https://api.hyprlab.io/v1beta/models/gemini-1.5-flash-002:generateContent?key=API_HERE" \
-H "Content-Type: application/json" \
-d '{
  "system_instruction": {
    "parts": {
      "text": "You are a helpful assistant."
    }
  },
  "contents": [
    {
      "role": "user",
      "parts": [{
        "text": "Hello"
      }]
    },
    {
      "role": "model",
      "parts": [{
        "text": "Great to meet you. What would you like to know?"
      }]
    },
    {
      "role": "user",
      "parts": [{
        "text": "I have two dogs in my house. How many paws are in my house?"
      }]
    }
  ],
  "generationConfig": {
    "temperature": 0.7,
    "topP": 0.95,
    "topK": 0,
    "max_output_tokens": 8192,
    "response_mime_type": "text/plain"
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
      "threshold": "BLOCK_NONE"
    }
  ]
}'

= = =

Node.js:

= = =

const axios = require('axios');

const API_KEY = 'API_HERE'; // Replace with your API key
const API_BASE = 'https://api.hyprlab.io';
const MODEL = 'gemini-1.5-flash-002';

async function generateContent() {
  const payload = {
    system_instruction: {
      parts: {
        text: "You are a helpful assistant."
      }
    },
    contents: [
      {
        role: "user",
        parts: [{
          text: "Hello"
        }]
      },
      {
        role: "model",
        parts: [{
          text: "Great to meet you. What would you like to know?"
        }]
      },
      {
        role: "user",
        parts: [{
          text: "I have two dogs in my house. How many paws are in my house?"
        }]
      }
    ],
    generationConfig: {
      temperature: 0.7,
      topP: 0.95,
      topK: 0,
      max_output_tokens: 8192,
      response_mime_type: "text/plain"
    },
    safetySettings: [
      {
        category: "HARM_CATEGORY_HARASSMENT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_HATE_SPEECH",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_DANGEROUS_CONTENT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_CIVIC_INTEGRITY",
        threshold: "BLOCK_NONE"
      }
    ]
  };

  try {
    const response = await axios({
      method: 'post',
      url: `${API_BASE}/v1beta/models/${MODEL}:generateContent?key=${API_KEY}`,
      headers: {
        'Content-Type': 'application/json'
      },
      data: payload
    });

    // Handle the response
    if (response.data.candidates && response.data.candidates.length > 0) {
      console.log('Model Response:', response.data.candidates[0].content.parts[0].text);
    } else {
      console.log('No response generated');
    }

    return response.data;
  } catch (error) {
    console.error('Error:', error.response ? error.response.data : error.message);
    throw error;
  }
}

// Call the function
generateContent()
  .then(result => {
    // Additional processing if needed
  })
  .catch(error => {
    console.error('Failed to generate content:', error);
  });

= = =

Python:

= = =

import requests

API_KEY = "API_HERE"  # Replace with your API key
API_BASE = "api.hyprlab.io"
MODEL = "gemini-1.5-flash-002"

def generate_content(conversation):
    """
    Generate content using Gemini Model
    
    Args:
        conversation: List of message objects with role and text
    """
    payload = {
        "system_instruction": {
            "parts": {
                "text": "You are a helpful assistant."
            }
        },
        "contents": conversation,
        "generationConfig": {
            "temperature": 0.7,
            "topP": 0.95,
            "topK": 0,
            "max_output_tokens": 8192,
            "response_mime_type": "text/plain"
        },
        "safetySettings": [
            {
                "category": "HARM_CATEGORY_HARASSMENT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_HATE_SPEECH",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
                "threshold": "BLOCK_NONE"
            }
        ]
    }

    response = requests.post(
        f"{API_BASE}/v1beta/models/{MODEL}:generateContent?key={API_KEY}",
        json=payload,
        headers={"Content-Type": "application/json"}
    )
    
    return response.json()

# Example usage
conversation = [
    {
        "role": "user",
        "parts": [{
            "text": "Hello"
        }]
    },
    {
        "role": "model",
        "parts": [{
            "text": "Great to meet you. What would you like to know?"
        }]
    },
    {
        "role": "user",
        "parts": [{
            "text": "I have two dogs in my house. How many paws are in my house?"
        }]
    }
]

response = generate_content(conversation)
if "candidates" in response:
    print(response["candidates"][0]["content"]["parts"][0]["text"])

Image Input:

= = =

Curl:

= = =

curl -X POST "https://api.hyprlab.io/v1beta/models/gemini-1.5-flash-002:generateContent?key=API_HERE" \
-H "Content-Type: application/json" \
-d '{
  "system_instruction": {
    "parts": {
      "text": "You are a helpful assistant."
    }
  },
  "contents": {
    "parts": [
      {
        "inline_data": {
          "mime_type": "image/jpeg",
          "data": "'$(base64 /path/to/image.jpg)'"
        }
      },
      {
        "text": "What do you see in this image?"
      }
    ]
  },
  "generationConfig": {
    "temperature": 0.7,
    "topP": 0.9,
    "topK": 40,
    "max_output_tokens": 8192,
    "response_mime_type": "text/plain"
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
      "threshold": "BLOCK_NONE"
    }
  ]
}'

= = =

Node.js:

= = =

const axios = require('axios');
const fs = require('fs');

const API_KEY = 'API_HERE'; // Replace with your API key
const API_BASE = 'https://api.hyprlab.io';
const MODEL = 'gemini-1.5-flash-002';

async function generateContentWithImage(imagePath) {
  // Read and convert image to base64
  const imageData = fs.readFileSync(imagePath);
  const base64Image = imageData.toString('base64');

  const payload = {
    system_instruction: {
      parts: {
        text: "You are a helpful assistant."
      }
    },
    contents: {
      parts: [
        {
          inline_data: {
            mime_type: "image/jpeg", // Adjust mime type based on your image
            data: base64Image
          }
        },
        {
          text: "What do you see in this image?"
        }
      ]
    },
    generationConfig: {
      temperature: 0.7,
      topP: 0.95,
      topK: 0,
      max_output_tokens: 8192,
      response_mime_type: "text/plain"
    },
    safetySettings: [
      {
        category: "HARM_CATEGORY_HARASSMENT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_HATE_SPEECH",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_DANGEROUS_CONTENT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_CIVIC_INTEGRITY",
        threshold: "BLOCK_NONE"
      }
    ]
  };

  try {
    const response = await axios({
      method: 'post',
      url: `${API_BASE}/v1beta/models/${MODEL}:generateContent?key=${API_KEY}`,
      headers: {
        'Content-Type': 'application/json'
      },
      data: payload
    });

    // Handle the response
    if (response.data.candidates && response.data.candidates.length > 0) {
      console.log('Model Response:', response.data.candidates[0].content.parts[0].text);
    } else {
      console.log('No response generated');
    }

    return response.data;
  } catch (error) {
    console.error('Error:', error.response ? error.response.data : error.message);
    throw error;
  }
}

// Example usage
generateContentWithImage('/path/to/image.jpg')
  .then(result => {
    // Handle result if needed
  })
  .catch(error => {
    console.error('Failed to generate content:', error);
  });

= = =

Python:

= = =

import base64
import requests

API_KEY = "API_HERE"  # Replace with your API key
API_BASE = "https://api.hyprlab.io"
MODEL = "gemini-1.5-flash-002"

def generate_content_with_image(image_path):
    """
    Generate content using Gemini Model with image input
    
    Args:
        image_path: Path to the image file
    """
    # Read and encode image to base64
    with open(image_path, "rb") as image_file:
        base64_image = base64.b64encode(image_file.read()).decode('utf-8')

    payload = {
        "system_instruction": {
            "parts": {
                "text": "You are a helpful assistant."
            }
        },
        "contents": {
            "parts": [
                {
                    "inline_data": {
                        "mime_type": "image/jpeg",  # Adjust mime type based on your image
                        "data": base64_image
                    }
                },
                {
                    "text": "What do you see in this image?"
                }
            ]
        },
        "generationConfig": {
            "temperature": 0.7,
            "topP": 0.95,
            "topK": 0,
            "max_output_tokens": 8192,
            "response_mime_type": "text/plain"
        },
        "safetySettings": [
            {
                "category": "HARM_CATEGORY_HARASSMENT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_HATE_SPEECH",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
                "threshold": "BLOCK_NONE"
            }
        ]
    }

    response = requests.post(
        f"{API_BASE}/v1beta/models/{MODEL}:generateContent?key={API_KEY}",
        json=payload,
        headers={"Content-Type": "application/json"}
    )
    
    return response.json()

# Example usage
try:
    response = generate_content_with_image("/path/to/image.jpg")
    if "candidates" in response:
        print(response["candidates"][0]["content"]["parts"][0]["text"])
except Exception as e:
    print(f"An error occurred: {e}")
Audio Input:

= = =

Curl:

= = =

curl -X POST "https://api.hyprlab.io/v1beta/models/gemini-1.5-flash-002:generateContent?key=API_HERE" \
-H "Content-Type: application/json" \
-d '{
  "system_instruction": {
    "parts": {
      "text": "You are a helpful assistant."
    }
  },
  "contents": {
    "parts": [
      {
        "inline_data": {
          "mime_type": "audio/mpeg",
          "data": "'$(base64 /path/to/audio.mp3)'"
        }
      },
      {
        "text": "What is being said in this audio?"
      }
    ]
  },
  "generationConfig": {
    "temperature": 0.7,
    "topP": 0.95,
    "topK": 0,
    "max_output_tokens": 8192,
    "response_mime_type": "text/plain"
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_HATE_SPEECH",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
      "threshold": "BLOCK_NONE"
    },
    {
      "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
      "threshold": "BLOCK_NONE"
    }
  ]
}'

= = =

Node.js:

= = =

const axios = require('axios');
const fs = require('fs');

const API_KEY = 'API_HERE'; // Replace with your API key
const API_BASE = 'https://api.hyprlab.io';
const MODEL = 'gemini-1.5-flash-002';

async function generateContentWithAudio(audioPath) {
  // Read and convert audio to base64
  const audioData = fs.readFileSync(audioPath);
  const base64Audio = audioData.toString('base64');

  const payload = {
    system_instruction: {
      parts: {
        text: "You are a helpful assistant."
      }
    },
    contents: {
      parts: [
        {
          inline_data: {
            mime_type: "audio/mpeg", // Adjust mime type based on your audio format
            data: base64Audio
          }
        },
        {
          text: "What is being said in this audio?"
        }
      ]
    },
    generationConfig: {
      temperature: 0.7,
      topP: 0.95,
      topK: 0,
      max_output_tokens: 8192,
      response_mime_type: "text/plain"
    },
    safetySettings: [
      {
        category: "HARM_CATEGORY_HARASSMENT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_HATE_SPEECH",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_DANGEROUS_CONTENT",
        threshold: "BLOCK_NONE"
      },
      {
        category: "HARM_CATEGORY_CIVIC_INTEGRITY",
        threshold: "BLOCK_NONE"
      }
    ]
  };

  try {
    const response = await axios({
      method: 'post',
      url: `${API_BASE}/v1beta/models/${MODEL}:generateContent?key=${API_KEY}`,
      headers: {
        'Content-Type': 'application/json'
      },
      data: payload
    });

    // Handle the response
    if (response.data.candidates && response.data.candidates.length > 0) {
      console.log('Model Response:', response.data.candidates[0].content.parts[0].text);
    } else {
      console.log('No response generated');
    }

    return response.data;
  } catch (error) {
    console.error('Error:', error.response ? error.response.data : error.message);
    throw error;
  }
}

// Example usage
generateContentWithAudio('/path/to/audio.mp3')
  .then(result => {
    // Handle result if needed
  })
  .catch(error => {
    console.error('Failed to generate content:', error);
  });

= = =

Python:

= = =

import base64
import requests

API_KEY = "API_HERE"  # Replace with your API key
API_BASE = "https://api.hyprlab.io"
MODEL = "gemini-1.5-flash-002"

def generate_content_with_audio(audio_path):
    """
    Generate content using Gemini Model with audio input
    
    Args:
        audio_path: Path to the audio file
    """
    # Read and encode audio to base64
    with open(audio_path, "rb") as audio_file:
        base64_audio = base64.b64encode(audio_file.read()).decode('utf-8')

    payload = {
        "system_instruction": {
            "parts": {
                "text": "You are a helpful assistant."
            }
        },
        "contents": {
            "parts": [
                {
                    "inline_data": {
                        "mime_type": "audio/mpeg",  # Adjust mime type based on your audio format
                        "data": base64_audio
                    }
                },
                {
                    "text": "What is being said in this audio?"
                }
            ]
        },
        "generationConfig": {
            "temperature": 0.7,
            "topP": 0.95,
            "topK": 0,
            "max_output_tokens": 8192,
            "response_mime_type": "text/plain"
        },
        "safetySettings": [
            {
                "category": "HARM_CATEGORY_HARASSMENT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_HATE_SPEECH",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                "threshold": "BLOCK_NONE"
            },
            {
                "category": "HARM_CATEGORY_CIVIC_INTEGRITY",
                "threshold": "BLOCK_NONE"
            }
        ]
    }

    response = requests.post(
        f"{API_BASE}/v1beta/models/{MODEL}:generateContent?key={API_KEY}",
        json=payload,
        headers={"Content-Type": "application/json"}
    )
    
    return response.json()

# Example usage
try:
    response = generate_content_with_audio("/path/to/audio.mp3")
    if "candidates" in response:
        print(response["candidates"][0]["content"]["parts"][0]["text"])
except Exception as e:
    print(f"An error occurred: {e}")
Video Input:

= = =

Curl:

= = =

= = =

Node.js:

= = =

= = =

Python:

= = =

File input:

= = =

Curl:

= = =

= = =

Nodejs:

= = =

= = =

Python:

= = =

Structured Output:

= = =

Curl:

= = =

= = =

Nodejs:

= = =

= = =

Python:

= = =

Function Calling:

= = =

Curl:

= = =

= = =

Node.js

= = =

= = =

Python:

= = =

Code Execution:

= = =

Curl:

= = =

= = =

Node.js:

= = =

= = =

Python:

= = =

Grounding: (Google Search Retrieval)

===

Curl:

===

===

Nodejs

===

===

Python

===

Thinking Mode:

===

Curl:

===

===

Nodejs

===

===

Python

===

Url Context: (Website Content Retrieval)

===

Curl:

===

===

Nodejs

===

===

Python

===

Image Generation:

✨ Gemini

Model Name:

  • gemini-3-pro

Discount:

  • 60% off

Prompts upto 200K:

  • Input: $0.8 / 1M Tokens

  • Output: $4.8 / 1M Tokens

Prompts longer than 200K:

  • Input: $1.6 / 1M Tokens

  • Output: $7.2 / 1M Tokens

Context Length:

  • 1,048,576

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Audio Input ✅

  • Video Input ✅

  • File Input ✅

  • Structured Output ✅

  • Function Calling ✅

  • Code Execution ✅

  • Grounding ✅

  • Thinking ✅

  • URL Context ✅

Model Name:

  • gemini-3-pro-image

Discount:

  • 50% off

Text Input:

  • $1 / 1M Tokens

Text Output:

  • $6 / 1M Tokens

Image Input:

  • $1 / 1M Tokens

Image Output:

  • $60 / 1M Tokens

Context Length:

  • 65,536

Moderation:

  • Unfiltered

Capabilities:

  • Grounding ✅

  • Image Input ✅

  • Structured Output ✅

  • Image generation ✅

Model Name:

  • gemini-3-flash

Discount:

  • 60% off

Input:

  • $0.2 / 1M Tokens

Output:

  • $1.2 / 1M Tokens

Context Length:

  • 1,048,576

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Audio Input ✅

  • Video Input ✅

  • File Input ✅

  • Structured Output ✅

  • Function Calling ✅

  • Code Execution ✅

  • Grounding ✅

  • Thinking ✅

  • URL Context ✅

Model Name:

  • gemini-2.5-flash-image

Discount:

  • 50% off

Text Input:

  • $0.15 / 1M Tokens

Text Output:

  • $1.25 / 1M Tokens

Image Input:

  • $0.15 / 1M Tokens

Image Output:

  • $15 / 1M Tokens

Context Length:

  • 65,536

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Structured Output ✅

  • Image generation ✅

Model Name:

  • gemini-2.5-pro

Discount:

  • 60% off

Prompts upto 200K:

  • Input: $0.5 / 1M Tokens

  • Output: $4 / 1M Tokens

Prompts longer than 200K:

  • Input: $1 / 1M Tokens

  • Output: $6 / 1M Tokens

Context Length:

  • 1,048,576

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Audio Input ✅

  • Video Input ✅

  • File Input ✅

  • Structured Output ✅

  • Function Calling ✅

  • Code Execution ✅

  • Grounding ✅

  • Thinking ✅

  • URL Context ✅

Model Name:

  • gemini-flash-latest

  • gemini-2.5-flash

Discount:

  • 60% off

Input:

  • $0.12 / 1M Tokens

Output:

  • $1 / 1M Tokens

Context Length:

  • 1,048,576

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Audio Input ✅

  • Video Input ✅

  • File Input ✅

  • Structured Output ✅

  • Function Calling ✅

  • Code Execution ✅

  • Grounding ✅

  • Thinking ✅

  • URL Context ✅

Model Name:

  • gemini-flast-lite-latest

  • gemini-2.5-flash-lite

Discount:

  • 60% off

Input:

  • $0.04 / 1M Tokens

Output:

  • $0.16 / 1M Tokens

Context Length:

  • 1,048,576

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Audio Input ✅

  • Video Input ✅

  • File Input ✅

  • Structured Output ✅

  • Function Calling ✅

  • Code Execution ✅

  • Grounding ✅

  • Thinking ✅

  • URL Context ✅

Model Name:

  • gemini-2.0-flash

Discount:

  • 60% off

Input:

  • $0.04 / 1M Tokens

Output:

  • $0.16 / 1M Tokens

Context Length:

  • 1,048,576

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Audio Input ✅

  • Video Input ✅

  • File Input ✅

  • Structured Output ✅

  • Function Calling ✅

  • Code Execution ✅

  • Grounding ✅

Model Name:

  • gemini-2.0-flash-lite

Discount:

  • 60% off

Input:

  • $0.03 / 1M Tokens

Output:

  • $0.12 / 1M Tokens

Context Length:

  • 1,048,576

Moderation:

  • Unfiltered

Capabilities:

  • Image Input ✅

  • Audio Input ✅

  • Video Input ✅

  • File Input ✅

  • Structured Output ✅

  • Function Calling ✅

Last updated