API Doc-CometAPI
HomeDashBoardModel Marketplace
HomeDashBoardModel Marketplace
Discord_Support
  1. šŸ’¬ Text Models
  • How to Use CometAPI?
  • šŸš€ Overview
    • Quick Start
    • Important Guidelines
    • Release Notes
    • Quickly request CometAPI via ApiDog
    • Models
  • šŸ’¬ Text Models
    • Chat
      POST
    • Responses
      POST
    • Anthropic Messages
      POST
    • Gemini Generating Content
      POST
    • Embeddings
      POST
  • šŸ–¼ļø Image Models
    • OpenAI
      • gpt-4o-image generates image
      • Images
      • Image Editing (gpt-image-1)
    • Gemini
      • Guide to calling gemini-3-pro-image (Nano Banana)
      • Gemini generates image
    • Midjourney
      • Midjourney Quick Start: Complete Image Generation Workflow in One Go
      • Task Fetching API
        • List by Condition
        • Fetch Single Task (most recommended)
      • Imagine
      • Submit Video
      • Submit Editor
      • Action (UPSCALE; VARIATION; REROLL; ZOOM, etc.)
      • Blend (image -> image)
      • Describe (image -> text)
      • Modal (Area Redesign & Zoom)
    • Replicate(image)
      • Create Predictions - General
      • replicate query
    • seededit/seedream
      • bytedance-Image Editing (seededit)
      • bytedance-image-generation(seedream)
    • bria
      • Generate Image
      • Generate Vector Graphics - Base (Beta)
      • Image Editing
      • Query Status
    • Flux(images)
      • flux generate image
      • flux query
  • šŸ“ŗ Video Models
    • sora-2
      • official
        • Create video
        • Remix video
        • Retrieve video
        • Retrieve video content
      • self-developed
        • Create video
        • Retrieve video
    • veo3
      • self-developed
        • Veo3 Async Generation
        • Veo3 Retrive
      • veo3-chat format
      • Submit video generation task
      • Query video generation status
    • kling (video)
      • callback_url
      • Multimodal Video Editing
        • Initialize Video for Editing
        • Add Video Selection
        • Delete Video Selection
        • Clear Video Selection
        • Preview Selected Video Area
        • Create Task
      • Text to Video
      • Image to Video
      • Multi-Image To Video
      • Video Extension
      • Avatar
      • Lip-Sync
      • Video Effects
      • Text to Audio
      • Video to Audio
      • TTS
      • Image Generation
      • Multi-Image to Image
      • Image Expansion
      • Image Recognize
      • Virtual Try-On
      • [Counterpart] Creating Tasks
      • Individual queries
    • runway(video)
      • official format
        • runway images raw video
        • Generate a video from a video
        • Generate an image from text
        • Upscale a video
        • Control a character
        • runway to get task details
      • Reverse Format
        • generate(text)
        • generate(Reference images)
        • Video to Video Style Redraw
        • Act-one Expression Migration
        • feed-get task
    • bytedance
      • bytedance-video
      • bytedance-video get
    • MiniMax Conch(video)
      • MiniMax Conch Official Documentation
      • MiniMax Conch Generation
      • MiniMax Conch Query
      • MiniMax Conch Download
  • šŸŽµ Music Models
    • Suno
      • Setting suno Version
      • Suno API Scenario Application Guide
      • Generate lyrics
      • Generate music clip
      • Upload clip
      • Submit concatenation
      • Full Track Audio Separation
      • Single Track Audio Separation
      • Create New Persona
      • add style tags
      • Single task query
      • Generate mp4 mv video
      • Timing: lyrics, audio timeline
      • Get wav format file
      • Get midi
      • Batch query tasks
  • šŸ”Š Audio Models
    • Realtime
    • Create speech
    • Create transcription
    • Create translation
  • 🧩 Integration Guides
    • LiteLLM
    • Dify
    • Make
    • n8n
    • Lobe-Chat
    • COZE
    • Zapier
    • Activepieces
    • LlamaIndex
    • Continue
    • FlowiseAI
    • Chatbox
    • CherryStudio
    • AnythingLLM
    • LangChain
    • BuildShip
    • gptme
    • Immersive Translation
    • Cline
    • Eudic Translation
    • ChatHub
    • OpenAI Translator
    • ChatAll Translation
    • Pot Translation
    • Zotero
    • NEXT CHAT (ChatGPT Next Web)
    • Obsidian's Text Generator Plugin
    • librechat
    • utools-ChatGPT Friend
    • avante.nvim
    • Open WebUI
    • GPT Academic Optimization (gpt_academic)
    • OpenManus
    • IntelliJ Translation Plugin
    • FastGPT
    • n8n Local Deployment
  • āš ļø Errors
    • Error Codes & Handling
  • šŸ“ Code Examples
    • Text-to-Image Generation
    • Image-to-image generation URL upload
    • Regular Post Text Conversation
    • OpenAI Official Library Usage Example
    • Streamed Output
    • Json Fixed Format Output Code Display
    • Embedding code example
    • o1-preview Model Code Example
    • LangChain Usage Example (Successful Test Date: 2024-11-25)
    • Openai dall-e-3 & flux series drawing model
    • gpt, claude, gemini multimodal network image parsing example
    • Multimodal PDF File Parsing Examples for GPT, Claude, and Gemini
    • Code example
  • šŸ„šŸ¼ā€ā™€ļø Best Practices
    • Midjourney Best Practices
    • Retry Logic Documentation for CometAPI and OpenAI Official API
    • Runway Best Practices
    • Claude Code Installation and Usage Guide
    • Gemini CLI Installation and Usage Guide
    • Codex Usage Guide
    • CometAPI Account Balance Query API Usage Instructions
  • šŸ’³ Pricing & Billing
    • About Pricing
  • šŸ¤šŸ¼ Support
    • Help Center
    • Interface Stability
    • Privacy policy
    • Terms of service
    • Common Misconceptions
    • Confusion about use
HomeDashBoardModel Marketplace
HomeDashBoardModel Marketplace
Discord_Support
  1. šŸ’¬ Text Models

Gemini Generating Content

POST
https://api.cometapi.com/v1beta/models/{model}:{operator}
Maintainer:Not configured

Gemini API Documentation#

āš ļø Latest News: gemini-3-pro-preview is now supported!

Introduction#

cometAPI supports Gemini native format calls. You can refer directly to the Gemini Official Documentation for development.

Quick Start#

Simply replace the Base URL and API Key in the official SDK or requests to use it:
Base URL: https://api.cometapi.com (replace generativelanguage.googleapis.com)
API Key: Replace $GEMINI_API_KEY with your $COMETAPI_KEY

Basic Example: Text Generation#

curl "https://api.cometapi.com/v1beta/models/gemini-3-pro-preview:generateContent" \
  -H "x-goog-api-key: $COMETAPI_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "How does AI work?"
          }
        ]
      }
    ]
  }'

FAQ#

1. How to control Thinking?#

Gemini models support a "thinking" process to improve reasoning capabilities. The control method depends on the model version.
For details, please refer to the official documentation: Gemini Thinking Guide

Gemini 3 Series (e.g., gemini-3-pro-preview)#

Use the thinkingLevel parameter to control thinking intensity ("LOW" or "HIGH").
curl "https://api.cometapi.com/v1beta/models/gemini-3-pro-preview:generateContent" \
  -H "x-goog-api-key: $COMETAPI_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{ "parts": [{ "text": "Explain quantum physics simply." }] }],
    "generationConfig": {
      "thinkingConfig": {
        "thinkingLevel": "LOW"
      }
    }
  }'

Gemini 2.5 Series (e.g., gemini-2.5-pro)#

Use the thinkingBudget parameter to control the Token budget for thinking.
0: Disable thinking.
-1: Dynamic thinking (model decides automatically, default).
> 0: Set a specific Token limit (e.g., 1024).
curl "https://api.cometapi.com/v1beta/models/gemini-2.5-pro:generateContent" \
  -H "x-goog-api-key: $COMETAPI_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{ "parts": [{ "text": "Solve this logic puzzle." }] }],
    "generationConfig": {
      "thinkingConfig": {
        "thinkingBudget": 1024
      }
    }
  }'

2. How to use Streaming Responses?#

Streaming responses allow you to receive results incrementally as the model generates content, reducing perceived latency.
For details, please refer to the official documentation: Gemini Text Generation - Streaming Responses
Note: The URL must point to streamGenerateContent and it is recommended to add ?alt=sse to use the Server-Sent Events format.
curl "https://api.cometapi.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse" \
  -H "x-goog-api-key: $COMETAPI_KEY" \
  -H 'Content-Type: application/json' \
  --no-buffer \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "text": "Explain how AI works"
          }
        ]
      }
    ]
  }'

Request

Path Params

Header Params

Body Params application/json

Examples

Responses

🟢200Success
application/json
Body

Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST 'https://api.cometapi.com/v1beta/models/gemini-3-pro-preview:generateContent' \
--header 'Authorization: ' \
--header 'Content-Type: application/json' \
--data-raw '{
  "contents": [
    {
      "parts": [
        {
          "text": "'\''Maintain the character features in the image to generate a new portrait photo: a woman leaning on a wooden railing of a traditional Chinese building. She is wearing a blue cheongsam with pink and red floral motifs and a headdress made of colorful flowers, including roses and lilacs. Her right hand gently touches a large kite with a blue background, decorated with pink fish motifs and a pair of large eyes. The background is the interior of an old wooden building, dimly lit and cozy. The painting style is realistic, focusing on the textural details of the clothing patterns, floral headdresses, and wooden buildings"
        }
      ]
    }
  ]
}'
Response Response Example
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {
            "text": "Here's a detailed prompt designed to achieve that specific vision, emphasizing the requested details and style:\n\n```\n**Character:** A beautiful, serene Asian woman with delicate features, a soft, gentle expression, and dark hair elegantly styled, possibly with a few wisps framing her face. She has subtle makeup, highlighting her natural beauty.\n\n**Pose and Attire:** She is leaning gracefully and comfortably against an ornate, dark wooden railing of a traditional Chinese building. Her right hand is delicately poised, gently touching a large, vibrant kite. She wears a stunning, richly textured **deep blue silk cheongsam (qipao)**. The cheongsam is adorned with intricate and vibrant **pink and crimson red floral motifs**, likely peonies, cherry blossoms, or other traditional Chinese flowers, showcasing exquisite embroidery and subtle brocade patterns that catch the light. The fabric should show a subtle sheen and deep textural detail.\n\n**Headdress:** An elaborate and colorful **headdress crafted from fresh, vivid flowers**, including lush, velvety roses (in shades of pink and red), delicate lavender lilacs, and perhaps smaller complementary blossoms, artfully arranged in her hair. Each petal and leaf should be distinctly rendered.\n\n**Prop (Kite):** A large, traditional Chinese kite with a prominent, rich **blue background**. It is beautifully decorated with playful and detailed **pink koi fish motifs** swimming across its surface. A pair of strikingly large, expressive eyes are painted on the kite, adding a touch of whimsy. The kite's material should appear slightly translucent and textured, showing the delicate framework beneath.\n\n**Background:** The interior of an ancient, richly textured traditional Chinese wooden building. The backdrop features intricately carved wooden beams, decorative lattice windows or screens, and aged wooden wall panels. The atmosphere is **dimly lit and cozy**, with warm, soft light filtering in from unseen windows or lanterns, creating subtle highlights and deep, inviting shadows. Focus on the authentic grain of the old wood and the fine details of the carvings.\n\n**Lighting and Style:** **Hyperrealistic portrait photography, extremely high detail.** The lighting should be soft, directional, and atmospheric, emphasizing the textures. There should be a shallow depth of field, with the woman and the kite in sharp, exquisite focus, while the background gently blurs into a warm, cozy ambiance. Emphasize the tactile qualities: the smooth sheen of the cheongsam, the soft, velvety petals of the roses, the delicate, papery texture of the kite, and the aged, rough grain of the wooden structures. Cinematic lighting.\n```"
          }
        ]
      },
      "finishReason": "STOP",
      "index": 0,
      "safetyRatings": null
    }
  ],
  "promptFeedback": {
    "safetyRatings": null
  },
  "usageMetadata": {
    "promptTokenCount": 122,
    "candidatesTokenCount": 526,
    "totalTokenCount": 1976,
    "thoughtsTokenCount": 1328,
    "promptTokensDetails": [
      {
        "modality": "TEXT",
        "tokenCount": 122
      }
    ]
  }
}
Modified atĀ 2025-11-19 13:09:53
Previous
Anthropic Messages
Next
Embeddings
Built with