A Faster Quickstart for OpenAI-Compatible Migrations

A Faster Quickstart for OpenAI-Compatible Migrations

A migration checklist to move existing OpenAI clients to AICredits in minutes while preserving request shape and tooling.

Author

Developer Experience

Published

24 Jan 2026

Reading time

4 min read

The two-line migration

If you are already using the OpenAI Python or TypeScript SDK, migrating to AICredits takes two changes:

# Before
from openai import OpenAI
client = OpenAI(api_key="sk-openai-...")
 
# After
from openai import OpenAI
client = OpenAI(
    base_url="https://api.aicredits.in/v1",
    api_key="sk-your-aicredits-key",
)

Everything else — chat.completions.create(), streaming, function calling, JSON mode — stays identical. Your existing code does not need to change.

Migration checklist

  1. Create an AICredits account at aicredits.in
  2. Top up your wallet in INR via UPI or net banking (minimum ₹50)
  3. Generate an API key from the dashboard
  4. Swap base_url and api_key in your client initialisation
  5. Keep your existing model names (e.g. gpt-4o, gpt-4o-mini) — they work as-is
  6. Test two representative requests before full rollout
  7. Enable budget limits per key to prevent unexpected spend
  8. Set up spend alerts in the dashboard

For TypeScript / Node.js

import OpenAI from "openai";
 
const client = new OpenAI({
  baseURL: "https://api.aicredits.in/v1",
  apiKey: process.env.AICREDITS_API_KEY,
});
 
const response = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Hello, world!" }],
});
 
console.log(response.choices[0].message.content);

Using other models

Once you are on AICredits, you can switch to any of the 300+ available models by changing only the model field. No new SDK, no new authentication:

# Use Claude instead of GPT-4o
response = client.chat.completions.create(
    model="anthropic/claude-3-5-sonnet-20241022",
    messages=[{"role": "user", "content": "Explain async/await in Python."}],
)
 
# Use Gemini
response = client.chat.completions.create(
    model="google/gemini-2.0-flash-001",
    messages=[{"role": "user", "content": "What is the capital of Karnataka?"}],
)

After migration

Enable budget limits per key and set spend alerts to avoid surprise consumption spikes. In the AICredits dashboard, set a maximum ₹ spend per API key — once hit, requests to that key are rejected cleanly rather than silently accumulating cost.

Related Articles

Continue in Docs

Need implementation commands and endpoint details? Go to quickstart or API reference.