AI API Quick Start
Get started with BillionGateway AI API in minutes. Compatible with OpenAI SDK and tools.
Base URL:
https://api.billiongateway.my.id/v1<> Getting Started
1Authentication
API Keys tabCreate an API key from the API Keys tab. Set a budget limit to control your spending across all LLM providers.
API Key Format:
sk-gw-live-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2Base Endpoint URL
All OpenAI-compatible libraries require only setting the base_url parameter. No provider SDK changes are needed.
https://api.billiongateway.my.id/v1
3Python SDK Example
pip install openaimain.py
from openai import OpenAI
# 1. Initialize client pointing to BillionGateway
client = OpenAI(
base_url="https://api.billiongateway.my.id/v1",
api_key="sk-gw-live-YOUR_KEY" # Single key for all models
)
# 2. Query any foundation model (Claude 3.5, GPT-4o, DeepSeek R1)
response = client.chat.completions.create(
model="claude-3-5-sonnet",
messages=[
{"role": "system", "content": "You are a senior systems architect."},
{"role": "user", "content": "Explain high-concurrency API gateway failover."}
],
temperature=0.7
)
print(response.choices[0].message.content)4Node.js / TypeScript Example
npm i openaiindex.ts
import OpenAI from "openai";
// Drop-in replacement for OpenAI SDK
const client = new OpenAI({
baseURL: "https://api.billiongateway.my.id/v1",
apiKey: "sk-gw-live-YOUR_KEY",
});
async function main() {
const completion = await client.chat.completions.create({
model: "deepseek-r1", // Or "gpt-4o", "claude-3-5-sonnet"
messages: [
{ role: "user", content: "Optimize this SQL query for high read throughput." }
],
});
console.log(completion.choices[0].message.content);
}
main();5cURL Direct Terminal Ping
terminal
curl https://api.billiongateway.my.id/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-gw-live-YOUR_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello BillionGateway!"}
]
}'6LangChain & Agent Swarms
langchain_agent.py
from langchain_openai import ChatOpenAI
# Drop-in compatible with LangChain ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.billiongateway.my.id/v1",
api_key="sk-gw-live-YOUR_KEY",
model="claude-3-5-sonnet"
)
response = llm.invoke("Summarize quantum error correction in two sentences.")
print(response.content)7Available Model IDs
claude-3-5-sonnetAnthropic • 200k context
deepseek-r1DeepSeek • Reasoning engine
gpt-4oOpenAI • Multimodal flagship
gemini-2.0-flashGoogle • 1M token context