TL;DR โ Switch in Under 10 Minutes
- Drop @google/generative-ai and google-cloud-aiplatform โ use the OpenAI SDK instead
- No GCP project, no service account JSON, no IAM roles โ just an API key
- Gemini 2.5 Pro, Flash, Flash-Lite all available through Chat Completions
- 1M context window preserved; multimodal (image, audio, video) inputs supported
- EU-hosted endpoint, EUR billing, plus 274 other models behind one API key
Why Move Off Google AI Studio / Vertex AI?
Google's Gemini is one of the most capable multimodal models on the market โ but accessing it via Vertex AI requires a GCP project, service account credentials, IAM bindings, and a billing account in USD. AI Studio is friendlier but rate-limited and not production-ready. Railwail exposes the same Gemini models through the standard OpenAI Chat Completions API with no GCP setup whatsoever.
Common migration triggers: avoiding GCP project sprawl, escaping AI Studio's free-tier RPM caps, EUR billing for European subsidiaries, and unifying Gemini calls with GPT-4o or Claude under one SDK.
Step 1 โ Get a Railwail API Key
Create an account at railwail.com and generate a key in Dashboard โ API Keys. No GCP project required.
Sponsored
Access 100+ AI Models with One API Key
GPT-4o, Claude, Gemini, Llama, Flux, DALL-E and more โ all through a single, OpenAI-compatible endpoint. No more juggling multiple providers.
Step 2 โ Replace the Google SDK
TypeScript / JavaScript
Before (Google AI Studio):
import { GoogleGenerativeAI } from "@google/generative-ai";
const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);
const model = genAI.getGenerativeModel({ model: "gemini-2.5-pro" });
const result = await model.generateContent("Hello Gemini");
console.log(result.response.text());After (Railwail via OpenAI SDK):import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.RAILWAIL_API_KEY,
baseURL: "https://api.railwail.com/v1",
});
const res = await client.chat.completions.create({
model: "gemini-2.5-pro",
messages: [{ role: "user", content: "Hello Gemini" }],
});
console.log(res.choices[0].message.content);The mental model shift is small: instead of generateContent on a model object, you call chat.completions.create with a messages array. This is the same shape you would use for GPT-4o or Claude โ one SDK, all models.Python
from openai import OpenAI
client = OpenAI(
api_key=os.environ["RAILWAIL_API_KEY"],
base_url="https://api.railwail.com/v1",
)
resp = client.chat.completions.create(
model="gemini-2.5-pro",
messages=[{"role": "user", "content": "Hello Gemini"}],
)
print(resp.choices[0].message.content)cURL
curl https://api.railwail.com/v1/chat/completions \
-H "Authorization: Bearer $RAILWAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-pro",
"messages": [{"role": "user", "content": "Hello Gemini"}]
}'Step 3 โ Multimodal Inputs (Images, Audio, Video)
Gemini's killer feature is native multimodality. On Railwail, multimodal inputs use the standard OpenAI vision schema (content array with image_url or input_audio blocks). Railwail translates to Gemini's native parts format internally.
const res = await client.chat.completions.create({
model: "gemini-2.5-pro",
messages: [{
role: "user",
content: [
{ type: "text", text: "What is in this image?" },
{ type: "image_url", image_url: { url: "https://example.com/img.jpg" } }
]
}],
});Step 4 โ Function Calling / Tool Use
Gemini's function calling translates to the OpenAI tools schema. Define your tools as JSON Schema, set tool_choice, and read tool_calls off the response โ Railwail handles the conversion to Gemini's tools.functionDeclarations format and back.
Sponsored
Test Any AI Model Instantly
Our built-in playground lets you compare models side by side. Find the perfect model for your use case in minutes, not days.
API Endpoint Mapping
Google AI endpoint โ Railwail equivalent
| Google direct | Railwail equivalent | Notes |
|---|---|---|
| POST /v1beta/models/{model}:generateContent | POST /v1/chat/completions | Same call, OpenAI schema |
| POST /v1beta/models/{model}:streamGenerateContent | POST /v1/chat/completions (stream=true) | SSE chunks |
| POST /v1beta/models/{model}:countTokens | Token count via usage.* on response | Returned automatically |
| POST /v1beta/models/{model}:embedContent | POST /v1/embeddings | model=text-embedding-005 etc. |
| GET /v1beta/models | GET /v1/models | Filter by provider=google |
| Vertex AI projects/{p}/locations/{l}/publishers/google/models/{m}:generateContent | POST /v1/chat/completions | No GCP project needed |
Gemini Model Mapping
Google model โ Railwail model ID
| Google AI / Vertex | Railwail | Notes |
|---|---|---|
| gemini-2.5-pro | gemini-2.5-pro | Frontier, 1M context, multimodal |
| gemini-2.5-flash | gemini-2.5-flash | Fast, cost-efficient |
| gemini-2.5-flash-lite | gemini-2.5-flash-lite | Cheapest option |
| gemini-2.0-pro | gemini-2.0-pro | Legacy, still routable |
| text-embedding-005 | text-embedding-005 | Embeddings |
| text-multilingual-embedding-002 | text-multilingual-embedding-002 | Multilingual embeddings |
| gemini-2.5-pro (audio) | gemini-2.5-pro | Use input_audio content blocks |
| gemini-2.5-pro (video) | gemini-2.5-pro | Use video_url content blocks |
Pricing Comparison (per 1M tokens, May 2026)
Same Gemini model, Railwail in EUR
| Model | Google direct (USD) | Railwail (EUR) | Notes |
|---|---|---|---|
| gemini-2.5-pro input | $1.25 / $2.50 (>200k) | EUR 1.15 / 2.30 | Tiered pricing preserved |
| gemini-2.5-pro output | $10.00 / $15.00 (>200k) | EUR 9.20 / 13.80 | Tiered |
| gemini-2.5-flash input | $0.10 | EUR 0.09 | Identical model |
| gemini-2.5-flash output | $0.40 | EUR 0.37 | Identical |
| gemini-2.5-flash-lite input | $0.075 | EUR 0.069 | Identical |
| text-embedding-005 | $0.02 | EUR 0.018 | Identical |
Sponsored
Pay Only for What You Use
Transparent per-token pricing with no monthly minimums. Start with free credits and scale as you grow.
Why Railwail Over Google AI Studio / Vertex
- No GCP project โ just an API key
- EUR billing with VAT receipts โ clean accounting for EU entities
- OpenAI-compatible SDK โ unify Gemini calls with GPT-4o, Claude, Llama in one client
- EU-hosted gateway โ Frankfurt region for GDPR-friendly logs
- Higher default rate limits than AI Studio's free-tier
- 1M context, multimodal, function calling โ all preserved
- Built-in playground to A/B Gemini vs other models on the same prompt
FAQ
Do I lose Gemini's 1M context window?
No. The full 1M-token context is available on gemini-2.5-pro through Railwail. Tiered pricing above 200k tokens is also passed through.
What about Gemini's grounding with Google Search?
Search grounding is a Vertex-specific feature that requires GCP-side configuration. Railwail does not currently expose it directly. For grounded responses, use Perplexity Sonar models on Railwail (perplexity-sonar-large), which provide similar real-time search functionality.
Can I do batch generation?
Yes. Railwail's POST /v1/batches accepts the OpenAI batch format for any Gemini model, with the same 50% discount on async workloads.
Is Gemini Live / real-time streaming supported?
Standard token streaming via SSE is supported. Gemini Live's bidirectional audio-stream API is on the roadmap โ track railwail.com/changelog for updates.
What about safety settings?
Gemini's safetySettings field is supported via the metadata.safety_settings extension parameter. Default thresholds match Google AI Studio's defaults.
Where is the data processed?
Railwail routes Gemini calls through Google's EU endpoint when you call from an EU origin, keeping inference data in-region. Request logs are stored in Frankfurt.
Next Steps
- Create your Railwail account at railwail.com
- Generate an API key in Dashboard โ API Keys
- Replace @google/generative-ai with the OpenAI SDK in your code
- Update baseURL to https://api.railwail.com/v1
- Read the full API reference at railwail.com/docs
- Browse Gemini models at railwail.com/models?provider=google
- Compare per-token pricing at railwail.com/pricing