با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
برای مشاهده محتوا و کد ارائه دهنده خاص در این صفحه، روی ارائه دهنده API Gemini خود کلیک کنید.
محدودیتهای نرخ (که معمولاً سهمیه نامیده میشود) تعداد درخواستهایی را که میتوانید به API Gemini در یک بازه زمانی معین ارسال کنید تنظیم میکند. این محدودیت ها به اطمینان از استفاده منصفانه، محافظت در برابر سوء استفاده و کمک به حفظ عملکرد سیستم برای همه کاربران کمک می کند.
هنگام استفاده از Firebase AI Logic برای ارسال درخواست به مدلهای Gemini و Imagen ، محدودیتهای نرخ پروژه شما به ارائهدهنده « Gemini API » انتخابی شما بستگی دارد. Firebase AI Logic همچنین راهی برای تعیین محدودیتهای نرخ «به ازای هر کاربر» فراهم میکند.
محدودیتهای نرخ (سهمیه) در چهار بعد اندازهگیری میشوند:
درخواست در دقیقه (RPM)
درخواست در روز (RPD)
توکن در دقیقه (TPM)
توکن در روز (TPD)
استفاده شما در برابر هر محدودیت ارزیابی میشود و تجاوز از هر یک از آنها خطای بیش از سهمیه 429 را ایجاد میکند. به عنوان مثال، اگر محدودیت RPM شما 20 باشد، انجام 21 درخواست در یک دقیقه منجر به خطا می شود، حتی اگر از TPM خود یا محدودیت های دیگر تجاوز نکرده باشید.
محدودیت های نرخ در سطح پروژه اعمال می شود و برای همه برنامه ها و آدرس های IP که از پروژه Firebase استفاده می کنند اعمال می شود.
محدودیت ها بسته به مدل خاصی که استفاده می شود متفاوت است و برخی محدودیت ها فقط برای مدل های خاص اعمال می شود. به عنوان مثال، تصاویر در دقیقه (IPM) فقط برای مدل هایی که قادر به تولید تصاویر هستند ( Imagen 3 ) محاسبه می شود، اما از نظر مفهومی مشابه TPM است.
محدودیتهای نرخ برای مدلهای آزمایشی و پیشنمایش محدودتر است.
برای استفاده از Firebase AI Logic ، پروژه شما نیاز دارد که ارائه دهنده API Gemini انتخابی شما فعال باشد، اما همچنین باید Firebase AI Logic API فعال باشد، که به عنوان یک دروازه بین SDK های مشتری ما و ارائه دهنده API Gemini شما عمل می کند. این API زمانی برای شما فعال می شود که در ابتدا Firebase AI Logic را در پروژه Firebase خود راه اندازی کردید.
میتوانید از محدودیت نرخ API AI Logic Firebase (سهمیه) بهعنوان محدودیت نرخ «بهازای هر کاربر» برای برنامه خود استفاده کنید ، بهویژه برای ویژگیهای AI که به Firebase AI Logic متکی هستند. شما باید این محدودیت را طوری تنظیم کنید که به طور معقولی یک کاربر را که به ویژگیهای هوش مصنوعی شما دسترسی دارد، تطبیق دهد، و در عین حال اطمینان حاصل کنید که هیچ کاربر به تنهایی بر محدودیتهای ارائهدهنده API Gemini شما (که قرار است توسط همه کاربران شما به اشتراک گذاشته شود) فائق آید.
جزئیات در مورد محدودیت نرخ "به ازای هر کاربر".
در اینجا برخی از جزئیات مهم در مورد محدودیت های نرخ API منطقی Firebase AI (سهمیه) - به طور خاص، درخواست در دقیقه (RPM) آورده شده است:
این بر اساس "تولید درخواست های محتوا" بر اساس هر کاربر در هر منطقه در دقیقه است، و بر اساس مدل نیست .
این محدودیت نرخی است که برای همه کاربران شما اعمال می شود. در حال حاضر، راهی برای تعیین محدودیت نرخ برای یک کاربر خاص یا گروه خاصی از کاربران وجود ندارد * .
در سطح پروژه اعمال می شود و برای همه برنامه ها و آدرس های IP که از پروژه Firebase استفاده می کنند اعمال می شود.
این برای هر تماسی که به طور خاص از هر Firebase AI Logic SDK انجام می شود اعمال می شود.
محدودیت سرعت پیش فرض 100 RPM برای هر کاربر است. توجه داشته باشید که همچنان باید محدودیتهایی را برای ارائهدهنده API Gemini خود در نظر بگیرید (به بالا مراجعه کنید)، که بر Firebase AI Logic API اولویت دارند.
*اگر از Vertex AI Gemini API استفاده میکنید و برنامه شما کاربران را به مناطق مختلف هدایت میکند (به عنوان مثال، با استفاده از Firebase Remote Config )، میتوانید محدودیت نرخ خاصی را برای کاربران در یک منطقه خاص تعیین کنید.
محدودیت نرخ "به ازای هر کاربر" را تنظیم کنید
برای تنظیم محدودیت نرخ (سهمیه)، باید مجوز serviceusage.quotas.update را داشته باشید که به طور پیش فرض در نقش مالک و ویرایشگر گنجانده شده است.
نحوه ویرایش محدودیت نرخ (سهمیه) یا درخواست افزایش در اینجا آمده است:
در پایین صفحه، روی برگه Quotas & System Limits کلیک کنید.
جدول را برای نشان دادن سهمیه های مورد علاقه، مانند قابلیت (درخواست تولید محتوا) و منطقه فیلتر کنید.
برای مثال، برای مشاهده سهمیههای هر کاربر برای ایجاد درخواستهای محتوا در هر یک از مناطق آسیایی پشتیبانیشده، فیلتر شما شبیه به این خواهد بود:Generate content requests + Dimension:region:asia
کادر انتخاب سمت چپ هر سهمیه مورد علاقه را انتخاب کنید.
در انتهای ردیف سهمیه، روی more_vert کلیک کنید و سپس Edit quota را انتخاب کنید.
در فرم تغییرات سهمیه موارد زیر را انجام دهید:
سهمیه افزایش یافته را در قسمت New value وارد کنید.
این سهمیه در سطح پروژه اعمال می شود و در همه برنامه ها و آدرس های IP که از پروژه Firebase استفاده می کنند به اشتراک گذاشته می شود.
هر فیلد اضافی را در فرم تکمیل کنید و سپس روی Done کلیک کنید.
تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-09-04 بهوقت ساعت هماهنگ جهانی."],[],[],null,["\u003cbr /\u003e\n\n\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| *Click your Gemini API provider to view provider-specific content and code on this page.* Gemini Developer API Vertex AI Gemini API |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nRate limits (commonly called quotas) regulate the number of requests you can\nmake to the Gemini API within a given timeframe. These limits help ensure\nfair usage, protect against abuse, and help maintain system performance for all\nusers.\n\nWhen using Firebase AI Logic to send requests to Gemini and\nImagen models, your project's rate limits depend on your chosen\n\"Gemini API\" provider. Firebase AI Logic also provides a way to\n[set \"per user\" rate limits](#per-user-rate-limits).\n\n[View rate limits for the Gemini Developer API](https://ai.google.dev/gemini-api/docs/rate-limits)\n| The rate limits (like requests per minute (RPM)) that are listed in the documentation are the *maximum* that the Gemini Developer API supports.\n|\n| The *actual maximum quota\n| **available to your Firebase project** and the model that\n| you're using* are dependent on several factors (for example,\n| the standing of your linked Cloud Billing account and capacity of the\n| overall system).\n\nHow rate limits (quotas) work\n\nRate limits (quotas) are measured across four dimensions:\n\n- Requests per minute (RPM)\n- Requests per day (RPD)\n- Tokens per minute (TPM)\n- Tokens per day (TPD)\n\nYour usage is evaluated against each limit, and exceeding any of them will\ntrigger a 429 quota-exceeded error. For example, if your RPM limit is 20, then\nmaking 21 requests within a minute will result in an error, even if you haven't\nexceeded your TPM or other limits.\n\nRate limits are applied at the project-level and apply to all applications and\nIP addresses that use that Firebase project.\n\nLimits vary depending on the specific model being used, and some limits only\napply to specific models. For example, images per minute (IPM) is only\ncalculated for models capable of generating images (Imagen 3), but is\nconceptually similar to TPM.\n\nRate limits are more restricted for experimental and preview models.\n\nRequest a rate limit increase\n\nIf you're on a \"paid tier\" for the Gemini Developer API, then you can\n[request a rate limit increase](https://ai.google.dev/gemini-api/docs/rate-limits#request-rate-limit-increase).\n\nSet \"per user\" rate limits\n\nTo use Firebase AI Logic, your project needs your chosen\nGemini API provider enabled, but you also need the\n[Firebase AI Logic API](https://console.cloud.google.com/apis/library/firebasevertexai.googleapis.com?project=_) enabled,\nwhich acts as a gateway between our client SDKs and your Gemini API\nprovider. This API is enabled for you when you initially set up\nFirebase AI Logic in your Firebase project.\n\n**You can use the Firebase AI Logic API rate limit (quota) as a\n\"per user\" rate limit for your app** , specifically for the AI features that rely\non Firebase AI Logic. You should\n[set this limit](#edit-quota-or-request-quota-increase) to reasonably\naccommodate a single user accessing your AI features, while also ensuring that\nno single user overwhelms the limits of your Gemini API provider (which is\nmeant to be shared by all your users).\n| **Note:** The Firebase AI Logic API rate limit is set quite high by default (100 RPM) to be usable for any app's use case. We recommend that you [adjust this rate limit](#edit-quota-or-request-quota-increase) to meet the actual needs of your app and use case.\n\nDetails about the \"per user\" rate limit\n\nHere are some important details about the Firebase AI Logic API\nrate limits (quotas) -- specifically, requests per minute (RPM):\n\n- It's based on \"Generate content requests\"\n on a per-user per-region per-minute basis, and it's *not* based on model.\n\n- It's the rate limit applied to *all* your users. Currently, there isn't a way\n to set the rate limit for a specific user or\n specific group of users^**\\***^.\n\n- It applies at the project-level and applies to all applications and IP\n addresses that use that Firebase project.\n\n- It applies to any call that specifically comes from any\n Firebase AI Logic SDK.\n\n- The default rate limit is 100 RPM per user. \n\n Note that you still need to consider the\n limits for your Gemini API provider (see above),\n which take precedence over the Firebase AI Logic API.\n\n^**\\*** *If you're using the Vertex AI Gemini API and your\napp directs users to different regions (for example, using\n[Firebase Remote Config](/docs/ai-logic/solutions/remote-config?api=vertex)),\nthen you could set a specific rate limit for users in a specific region.*^\n\nAdjust the \"per user\" rate limit\n\nTo adjust a rate limit (quota), you must have the `serviceusage.quotas.update`\npermission, which is included by default in the Owner and Editor role.\n\nHere's how to edit your rate limit (quota) or request an increase:\n\n1. In the Google Cloud console, go to the page for the\n [Firebase AI Logic API](https://console.cloud.google.com/apis/library/firebasevertexai.googleapis.com?project=_).\n\n2. Click **Manage**.\n\n3. Lower on the page, click the **Quotas \\& System Limits** tab.\n\n4. Filter the table to show the quotas of interest, like the capability\n (requests for generating content) and region.\n\n For example, to view the per-user quotas for generating content requests\n in any of the supported Asian regions, your filter would look similar to\n this:\n `Generate content requests` + `Dimension:region:asia`\n | **Note:** To create a `Dimension` filter, you need to use the filter tooling, rather than just copy-pasting the values in this example above. Also, the `(default)` quota row doesn't apply to Firebase AI Logic.\n5. Select the checkbox to the left of each quota of interest.\n\n6. At the end of the quota's row, click\n more_vert,\n and then select **Edit quota**.\n\n7. In the **Quota changes** form, do the following:\n\n 1. Enter the increased quota in the *New value* field.\n\n This quota applies at the project-level and is shared across\n all applications and IP addresses that use that Firebase project.\n 2. Complete any additional fields in the form, and then click **Done**.\n\n 3. Click **Submit request**."]]