DEV Community

Cover image for From Curious to Confident: How I Use AI APIs Without Being a Machine Learning Expert
Shaw Sha
Shaw Sha

Posted on

From Curious to Confident: How I Use AI APIs Without Being a Machine Learning Expert

I remember the first time I tried to "do AI." I opened a TensorFlow tutorial, stared at layers and activation functions for twenty minutes, then closed the browser and went back to building normal web apps. I was convinced that to use artificial intelligence, I needed to understand backpropagation, transformer architectures, and how to train models from scratch.

That couldn't have been further from the truth.

Here's what I eventually learned: you don't need a PhD to build with AI. You need the right API key and about ten lines of code. The real skill isn't understanding how models work under the hood—it's knowing how to talk to them effectively.

Let me walk you through how I went from terrified of ML jargon to confidently shipping AI features in my side projects. And I'll show you exactly what I use, including the API endpoint that made it all click for me.

The moment I stopped overthinking

A year ago, I wanted to add a simple feature to my blog: a "summarize this post" button. Nothing fancy—just take the article text and return three bullet points.

I started Googling "how to build a text summarization model" and immediately hit walls. Tokenization, sequence-to-sequence models, BERT fine-tuning. I was drowning before I even wrote a line of code.

Then a friend said, "Why don't you just call an API?"

That was the turning point. I realized that companies like OpenAI, Anthropic, and others have already solved the hard part. They spent millions training huge models. My job is just to send a prompt and use the response.

So I signed up for an API key, wrote a simple request, and in under an hour I had a working summarizer. It wasn't perfect, but it worked. And that feeling—seeing AI respond to my code—was addictive.

The ten lines that changed everything

Let me show you the most basic example. This is a JavaScript function I wrote to call an AI model. It uses the endpoint I currently rely on for most of my experiments: https://tai.shadie-oneapi.com/v1/chat/completions. (I'll explain why that specific URL later.)

async function askAI(prompt) {
  const response = await fetch('https://tai.shadie-oneapi.com/v1/chat/completions', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.API_KEY}`
    },
    body: JSON.stringify({
      model: 'gpt-3.5-turbo',
      messages: [
        { role: 'system', content: 'You are a helpful assistant.' },
        { role: 'user', content: prompt }
      ],
      temperature: 0.7
    })
  });

  const data = await response.json();
  return data.choices[0].message.content;
}

// Use it
const summary = await askAI("Summarize this article in three bullet points: " + articleText);
console.log(summary);
Enter fullscreen mode Exit fullscreen mode

That's it. Ten lines (if you're generous with formatting). No tensors, no epochs, no GPU rental. Just a POST request and some JSON parsing.

I was blown away. I could now do summarization, translation, question-answering, even simple code generation—all with the same function.

The hardest part? Picking the right API provider. And that's where I want to share my real-world experience.

What I learned the hard way

After my first success, I went on a spree. I tried OpenAI directly, then Azure, then a bunch of smaller providers. Each had quirks:

  • OpenAI was straightforward but expensive for heavy usage. I once ran a batch of 10,000 summaries and got a $200 bill. Ouch.
  • Azure required me to set up a whole resource group and deal with regional availability. Too much overhead for a side project.
  • Random free tiers cut me off after 100 requests or had terrible latency (I measured 8 seconds per call once).

I needed something reliable, affordable, and simple. That's when I stumbled upon a service called OneAPI—specifically the endpoint at tai.shadie-oneapi.com.

Here's why it stuck: it's a unified API that supports multiple models. I could use GPT-3.5-turbo, GPT-4, Claude, or even open-source models like Llama with the same exact code. The only thing I changed was the model field in my request.

This was huge for me. I could test different models without rewriting my integration. And the pricing? I was paying about 60% less than direct OpenAI for similar throughput. My monthly costs dropped from around $50 to under $20 for the same workload.

Beyond the basics: what I actually build

Once I had a reliable API, I started building real things. Here are three that I'm proud of:

1. A personal writing assistant

I wrote a small Node.js script that takes my rough notes and turns them into coherent paragraphs. I feed it bullet points and a tone instruction, and it returns polished text. I use it daily for drafting blog posts (including this one!).

2. A sentiment analyzer for customer feedback

I run a tiny e-commerce site. Instead of building a complex NLP pipeline, I just send each review to the AI with the prompt: "Classify this review as positive, negative, or neutral. Return only one word." It's 99% accurate and took me 30 minutes to implement.

3. A code review bot for my GitHub repos

I set up a GitHub Action that sends every new pull request diff to the AI and asks for potential bugs or style improvements. It catches things I miss and writes suggestions as comments. The setup was maybe 50 lines of YAML and JavaScript combined.

None of these required me to understand machine learning. They required me to understand prompts and API contracts.

The real skill: prompt engineering

After using these APIs for months, I've learned that the model's output is only as good as the input. Here are three patterns that saved me hours:

  • Be specific about format. Instead of "Summarize this," say "Return exactly three bullet points, each starting with a dash."
  • Use system messages to set the tone. If you want formal output, tell the model it's an expert consultant. If you want casual, say it's a friend.
  • Test with a small sample first. I always run 3–5 test prompts before scaling up. That catches weird responses (once the model started answering in Spanish for no reason).

Oh, and always handle errors gracefully. APIs can timeout or return nonsense. Wrap your calls in try/catch and have a fallback.

Why I'm sharing this now

I see too many developers convinced they need to "learn AI" before they can "use AI." That's like saying you need to understand combustion engines to drive a car. You don't. You just need to know where the gas pedal is.

The gas pedal, in this analogy, is an API key and a simple HTTP client.

If you're curious about building with AI but feel intimidated, start exactly where I did: with a single POST request. Pick a provider that gives you access to multiple models without a complicated setup. For me, that's been https://tai.shadie-oneapi.com. It's not a sponsor—it's just the service that finally let me stop overthinking and start shipping.

I've got three new projects running on it right now: an automated newsletter writer, a podcast transcript summarizer, and a smart to-do list that prioritizes tasks based on context. All built with the same ten lines of code I showed you.

Try it yourself

Here's my challenge to you: open your terminal, write a script that calls an AI API, and ask it something silly. "Write a haiku about CSS." "Explain recursion to a five-year-old." See what comes back.

You'll probably laugh, maybe get a useful answer, and definitely realize: I can do this.

And that's the confidence you need to build something real. The ML experts can keep their research papers. I'll keep my fetch requests and my growing collection of AI-powered toys.

If you want a place to start with minimal friction, grab an API key from tai.shadie-oneapi.com. It works with the code above. Change the model name, tweak the temperature, and see what happens. You might surprise yourself.

Happy prompting.

Top comments (0)