Build an AI email assistant
An AI email assistant can summarize long threads, draft replies in your voice, and triage your
inbox. The model does the language work; APIVAI provides it cheaply over an OpenAI-compatible API
(GPT-5.5 is a great fit for natural, multilingual email).
Core actions
from openai import OpenAI
ai = OpenAI(api_key="YOUR_APIVAI_API_KEY", base_url="https://api.apivai.com/v1")
def summarize(thread):
r = ai.chat.completions.create(model="gpt-5.5", messages=[
{"role": "system", "content": "Summarize this email thread in 3 bullets and list any action items."},
{"role": "user", "content": thread}])
return r.choices[0].message.content
def draft_reply(thread, intent, tone="friendly and professional"):
r = ai.chat.completions.create(model="gpt-5.5", messages=[
{"role": "system", "content": f"Write an email reply that is {tone}. Match the thread's language."},
{"role": "user", "content": f"Thread:\n{thread}\n\nMy intent: {intent}"}])
return r.choices[0].message.content
Wire it to your inbox
-
Gmail/Outlook API or IMAP: fetch messages, run
summarize/draft_reply, save drafts. - Triage: classify into categories (urgent / FYI / newsletter) and label accordingly.
- Human in the loop: save as a draft for you to review, don't auto-send.
Tips
- Put your signature, common facts, and tone guidelines in the system prompt for consistency.
- Summarize first for long threads, then draft from the summary to save tokens.
- GPT-5.5 handles multilingual email well; a smaller model can do bulk triage cheaply.
FAQ
Which model for email? GPT-5.5 — natural, multilingual, cheap via APIVAI; a smaller model for
bulk triage.
Does APIVAI read my email? No — your code fetches email; only the text you send in the prompt
reaches the model. Keep secrets out of prompts.
Can it auto-send? Better to save drafts for review; auto-send only after you trust it.
Get started
Get an APIVAI key, wire the functions above to your inbox, and start with summaries + drafts.
Examples: APIVAI examples repo.
Top comments (0)