OG Dynamic API: several API keys, rotation and failover for OG AI Core

Jellybean, the OG Nexus mascot: OG Dynamic API: several API keys, rotation and failover for OG AI Core

OG Dynamic API is an add-on for OG AI Core that we build at OG Nexus. It lets each OG AI Core environment use several API keys. It shares the work between them and moves to another key when one hits a rate limit, a quota or an authentication error. It works with OG AI Core free or Pro.

This guide explains how it picks a key and what it does when nothing fits. If you have ever watched a chatbot fail at the worst moment, this is the add-on for that.

The problem it solves

An AI chatbot is only as reliable as the key behind it. Picture a shop chatbot on a busy sale morning. Questions pour in, the provider says "too many requests", and replies start to fail. Your visitor sees an error, not an answer, and may not come back.

That signal is the HTTP status 429 Too Many Requests. Quota and billing limits, and the 401 and 403 errors of a bad key, stop replies in the same way. OG Dynamic API recognises all of them and switches key before the next request.

Several keys per environment

In OG AI Core, an environment is one AI provider with its key and settings. OG Dynamic API adds a list of extra keys to any environment. Each key has:

a label, so you know which account or project it belongs to;

an on/off switch;

a weight from 1 to 100;

an optional daily soft cap on requests.

Once a key is saved, it is never shown again. The screen only shows its last four characters.

Sharing the load

You pick one of two ways to share the work:

Round-robin: the keys take turns, one after the other.

Weighted: keys with a higher weight get a bigger share.

When a key reaches its daily soft cap, it sits out for the rest of the day. The other keys carry on.

Automatic failover

A key that hits a rate limit, a quota or billing limit, or an authentication error goes into a cooldown. It is skipped for five minutes by default, and the next key takes over. You can set the cooldown anywhere up to a full day.

The add-on reads the error message to decide which kind of failure it is. A message such as "429 You exceeded your current quota" counts as a quota problem, not just a busy moment.

Rules

Rules send a kind of work to the keys you choose. You can route embeddings, images, transcription, text or one chosen chatbot.

Keys marked rules only are used by rules and nothing else. That is handy for pinning a chatbot to one project.

The fail safe

When no key is usable, OG Dynamic API leaves the query alone. OG AI Core then sends it with the environment's own key, as it would without the add-on. Nothing breaks, and no reply is lost because of the add-on.

The same happens when an engine would ignore a per-query key. The add-on does not pretend; it steps aside.

Which providers use the extra keys

OpenAI, Azure, Anthropic and OpenRouter send the add-on's key for every query type they support.

Google Gemini sends it for text through the Interactions API, OG AI Core's default for Gemini.

Gemini embeddings, images and transcription keep the environment's own key. So does any Gemini query with "Use Standard API" turned on.

OpenAI Assistants keep the environment's own key.

One thing to know before you add keys

This is easy to miss. Providers usually limit rates per account or project, not per key. Two keys from the same project share one limit. Rotation only adds capacity when the keys come from different accounts or projects.

Some features keep state at the provider, such as uploaded files, vector stores and the Responses API's previous response. They need the same project every time. Pin those chatbots to one key with a rule.

The Status page

The Status page shows today's requests and failures for every key. It also shows any cooldowns, the last error of each key, and the recent decisions. Error messages are stored without keys and cut to 300 characters.

Set it up, step by step

1

Install OG Dynamic API from OG AI Core > Manage add-ons.

2

Open OG AI Core > Add-ons > Dynamic API. The side rail has two sections: Settings and Status.

3

Under General, tick Rotation and set the Cooldown in minutes.

4

Each OG AI Core environment has its own panel. Pick a Distribution: Round-robin or Weighted.

5

Under Keys, add a label and paste each API key, then set its weight and daily soft cap.

6

Add Rules if a kind of work or a chatbot should only use certain keys.

7

Save, run a query (the Playground is fine), and open Status to see which key was picked.

OG Dynamic API settings: rotation, cooldown and keys

Dynamic API: rotation, cooldown, and the keys for one environment. Saved keys only ever show their last four characters.

Every setting explained

Rotation: use the keys below for OG AI Core queries. When off, every query uses OG AI Core's own keys and nothing is counted.

Cooldown: how many minutes a key is skipped after a rate-limit (429), quota or authentication (401 or 403) error.

Distribution: Round-robin (one after the other) or Weighted (by the weight of each key).

Keys: Label, API key, Enabled, Weight (1 to 100), Daily soft cap (0 means no cap; counters restart at midnight in the site time zone), Rules only, and Remove. Leave a key field empty to keep the saved key.

Rules: checked from top to bottom. The first enabled rule that matches decides which keys a query may use. A rule can match query types (text, embeddings, images, transcription, assistant) and chatbot IDs. Empty fields match anything.

Status: requests and failures today for each key, cooldowns with a Clear cooldown button, the last error, and the recent decisions.

What we would do first

1

Open OG AI Core > Add-ons > Dynamic API, then Status, and check it shows clean skips.

2

Create a second key in a different project or account at your provider.

3

Add both keys to the environment your busiest chatbot uses.

4

Start with round-robin. Move to weighted only if one account has more capacity.

5

Add a rule for any chatbot that uses files or vector stores.

6

Watch the Status page for a day, then set daily soft caps if you need them.

Developers get two filters: ogda_error_kind to classify an error yourself, and ogda_engine_uses_query_key to say whether an engine sends per-query keys.

Who it is for

Busy sites and agencies running OG AI Core. It suits anyone who wants more capacity and fewer failed replies by spreading work across keys from different accounts or projects.

Getting it

OG Dynamic API runs with an OG Nexus licence key and needs OG AI Core. See the OG AI documentation or the whole OG plugin family.

Keep reading