OpenAI SDK
Use Revo Mail with the official OpenAI Python and Node.js SDKs — no new dependencies required.
How It Works
Because Revo Mail speaks the OpenAI Chat Completions protocol, the official openai SDK connects to it with two configuration changes:
- Set
base_urltohttps://api.revomail.io/v1 - Set
api_keyto your Revo Mail key
Everything else — method names, response objects, streaming helpers — stays identical.
Python
Install the SDK
pip install openaiConfigure and Send a Request
from openai import OpenAI
Revo Mail = OpenAI(
base_url="https://api.revomail.io/v1",
api_key="YOUR_Revo Mail_API_KEY",
)
response = Revo Mail.chat.completions.create(
model="kimi-k2.6",
messages=[
{"role": "system", "content": "You are a concise technical assistant."},
{"role": "user", "content": "What is the difference between REST and GraphQL?"},
],
)
print(response.choices[0].message.content)Streaming in Python
stream = Revo Mail.chat.completions.create(
model="deepseek-v3.2",
messages=[{"role": "user", "content": "Walk me through writing a binary search."}],
stream=True,
)
for chunk in stream:
fragment = chunk.choices[0].delta.content
if fragment:
print(fragment, end="", flush=True)
print() # newline after stream endsLoad Credentials from the Environment
Store your key and base URL as environment variables so they never appear in source code:
export OPENAI_API_KEY="sk-llmaai-your-key-here"
export OPENAI_BASE_URL="https://api.revomail.io/v1"Then instantiate the client without arguments — the SDK picks them up automatically:
from openai import OpenAI
Revo Mail = OpenAI() # reads OPENAI_API_KEY and OPENAI_BASE_URL from environmentOr put them in a .env file and load with python-dotenv:
OPENAI_API_KEY=sk-llmaai-your-key-here
OPENAI_BASE_URL=https://api.revomail.io/v1Node.js / TypeScript
Install the SDK
npm install openaiConfigure and Send a Request
import OpenAI from "openai";
const Revo Mail = new OpenAI({
baseURL: "https://api.revomail.io/v1",
apiKey: process.env.Revo Mail_API_KEY,
});
const result = await Revo Mail.chat.completions.create({
model: "minimax-m3",
messages: [
{ role: "user", content: "Summarize the main benefits of containerisation." },
],
});
console.log(result.choices[0].message.content);Streaming in Node.js
const stream = await Revo Mail.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{ role: "user", content: "Explain async/await in JavaScript." }],
stream: true,
});
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content ?? "";
process.stdout.write(text);
}
process.stdout.write("\n");Environment Variables (.env)
Revo Mail_API_KEY=sk-llmaai-your-key-here
OPENAI_BASE_URL=https://api.revomail.io/v1Changing Models at Runtime
Swapping providers is a single-field change — no client reconfiguration needed:
# Use Kimi's flagship long-context model
response = Revo Mail.chat.completions.create(model="kimi-k2.6", messages=[...])
# Switch to MiniMax's 1M-context model
response = Revo Mail.chat.completions.create(model="minimax-m3", messages=[...])
# Switch to a cost-efficient option
response = Revo Mail.chat.completions.create(model="deepseek-v4-flash", messages=[...])See the Models page for every available slug.