DEV Community

diwushennian4955
diwushennian4955

Posted on • Originally published at nexa-api.com

I Built an AI Resume Tailor in 50 Lines of Python (Using the Cheapest LLM API)

Inspired by launchway — an AI-powered job application CLI that's been trending on PyPI — I built a minimal resume tailoring agent in 50 lines of Python.

The key insight: NexaAPI's pricing makes autonomous agents economically viable at scale.

The Code (50 lines)

from openai import OpenAI

# NexaAPI is OpenAI-compatible — drop-in replacement
client = OpenAI(
    api_key="YOUR_NEXAAPI_KEY",
    base_url="https://nexaapi.com/v1"
)

MASTER_RESUME = """
John Doe | Python Developer
Skills: Python, FastAPI, PostgreSQL, Docker, AWS
Experience: 4 years backend development at fintech startup
Projects: Built payment API handling 10k TPS, ML pipeline for fraud detection
"""

def tailor_resume(job_description: str) -> str:
    response = client.chat.completions.create(
        model="llama-3-70b-instruct",
        messages=[
            {
                "role": "system", 
                "content": "Rewrite the resume to match this job. Keep truthful. Output clean markdown."
            },
            {
                "role": "user",
                "content": f"Resume:\n{MASTER_RESUME}\n\nJob:\n{job_description}"
            }
        ],
        max_tokens=800
    )
    return response.choices[0].message.content

def score_fit(resume: str, jd: str) -> float:
    """Simple keyword overlap scoring (use embeddings for production)."""
    resume_words = set(resume.lower().split())
    jd_words = set(jd.lower().split())
    overlap = len(resume_words & jd_words)
    return overlap / len(jd_words) if jd_words else 0

# Process multiple job listings
jobs = [
    "Senior Python Developer, FastAPI, PostgreSQL, 5+ years, $150k",
    "Data Engineer, Spark, Airflow, AWS, 3+ years, $130k",
    "ML Engineer, PyTorch, MLflow, 4+ years, $160k",
]

results = []
for jd in jobs:
    score = score_fit(MASTER_RESUME, jd)
    tailored = tailor_resume(jd) if score > 0.1 else None
    results.append({"jd": jd[:50], "score": score, "tailored": tailored is not None})
    print(f"Score: {score:.2f} | {jd[:50]}")

apply_list = [r for r in results if r["tailored"]]
print(f"\nApplying to {len(apply_list)}/{len(jobs)} jobs")
Enter fullscreen mode Exit fullscreen mode

Why NexaAPI?

Each resume tailoring call costs $0.0009 with llama-3-70b via NexaAPI.

  • 1,000 calls = $0.90
  • 10,000 calls = $9.00
  • Same with OpenAI GPT-4o: ~$50-80

That's the difference between a side project and a scalable product.

The Full Pipeline

For production use, check out the full pipeline with:

  • Embeddings-based fit scoring
  • Structured JD parsing
  • Autonomous apply logic

👉 Full tutorial on NexaAPI blog
👉 GitHub repo with working code
👉 Run in Colab

Get Started

  1. Sign up at nexaapi.com — free tier, no credit card
  2. pip install openai
  3. Change base_url to https://nexaapi.com/v1
  4. 56+ models available, same API format

NexaAPI pricing: llama-3-70b $0.90/1M tokens. OpenAI gpt-4o-mini: $0.60/1M input + $2.40/1M output. Data from official pricing pages, March 2026.

Top comments (0)