Stop losing tokens to rate limits

Your keys fail.
Your app doesn't.

One API key hits a rate limit and your entire pipeline stalls. APIShift pools your keys, rotates to healthy ones instantly, and only falls back when every key is cooling down.

Install
python$ pip install APIShift
npm$ npm install @apishift/core

See it break. See it recover.

Rate limited? Already shifted.

Watch APIShift exhaust a Gemini key pool — keys fail, rotation kicks in, and when the whole pool is down, a fallback provider picks up mid-sentence without losing a single token.

apishift terminalv1.0.0
gemini-key-1
gemini-key-2
openrouter
Active
Shifting
Failed
Standby

< 5ms
Failover overhead
0
Tokens lost on shift
3+
Providers supported

Three ways to start

Copy. Paste. Ship.

Drop the agent prompt into Cursor, paste the Python snippet, or wire up the TypeScript SDK — you're resilient in under a minute.

Coding Agent
// Paste into Cursor, Windsurf, Claude Code // or any AI coding agent: Add APIShift to my project with a Gemini key pool using adaptive rotation, streaming, memory, and fallback only if needed at .apishift/memory.jsonl
Python
from APIShift import Conversation conv = Conversation.from_gemini_key_pool( api_keys=['KEY_1', 'KEY_2', 'KEY_3'], key_strategy='adaptive', memory_path='.apishift/memory.jsonl', ) for chunk in conv.send_message_stream("Hello"): print(chunk, end="", flush=True)
TypeScript
import { APIShift } from '@apishift/core'; import { google } from '@ai-sdk/google'; const shift = new APIShift([ { provider: 'gemini', keyIndex: 0, model: google('gemini-1.5-flash', { apiKey: process.env.GEMINI_KEY_1 }) }, { provider: 'gemini', keyIndex: 1, model: google('gemini-1.5-flash', { apiKey: process.env.GEMINI_KEY_2 }) } ], { keyStrategy: 'adaptive' }); await shift.streamMessage('Hello');

Built for production

Everything your API keys need.


Stop babysitting API keys.

Let APIShift handle rotation, cooldowns, and failover. You handle the product. Open source, MIT licensed, free forever.

Get startedStar on GitHub