Migration is a one-line change
Python (OpenAI SDK)
# Change only these 2 lines
client = OpenAI(
base_url="https://api.aicredits.in/v1",
api_key="sk-your-aicredits-key"
)
# Access any model by name
response = client.chat.completions.create(
model="claude-3-5-sonnet",
messages=[{"role": "user", "content": "Hello"}],
)TypeScript (OpenAI SDK)
// Change only these 2 lines
const client = new OpenAI({
baseURL: "https://api.aicredits.in/v1",
apiKey: "sk-your-aicredits-key",
});
// Access Claude, Gemini, DeepSeek & more
const response = await client.chat.completions.create({
model: "gemini-1.5-flash",
messages: [{ role: "user", content: "Hello" }],
});Everything that works with OpenAI works with AICredits
Frequently Asked Questions
What does 'OpenAI-compatible' actually mean?
It means AICredits uses the exact same API format as OpenAI's chat completions endpoint. You change base_url and api_key — everything else in your code (messages format, streaming, tool definitions, response parsing) stays identical.
Does it work with LangChain?
Yes. Set the base_url to https://api.aicredits.in/v1 in your ChatOpenAI or OpenAI LangChain wrapper. LangChain doesn't need to know you've switched — it just works.
Can I access Claude and Gemini through the same OpenAI SDK?
Yes. Specify 'claude-3-5-sonnet' or 'gemini-1.5-pro' as the model field in your request. AICredits routes it to the correct provider and translates the response back to OpenAI format.
Does streaming work the same way?
Yes. Server-sent events (SSE) streaming works identically. Set stream=True in your request and parse the chunks exactly as you would with OpenAI.
What about tool calling / function calling?
Full tool calling support is available for models that support it. The request and response format is identical to OpenAI's tool_calls format.