DEV Community

Alex Spinov
Alex Spinov

Posted on

OpenAI Has a Free API Tier — Build ChatGPT Apps, Generate Images, and Use GPT-4o Mini Without Breaking the Bank

OpenAI gives every new developer $5 in free credits — enough for thousands of API calls with GPT-4o mini. You can build chatbots, generate images with DALL-E, transcribe audio with Whisper, and create embeddings for search. All through a simple REST API.

Here's how to start building with it.

Get Your Free API Key

  1. Sign up at platform.openai.com
  2. Go to API keys → "Create new secret key"
  3. Copy your key (starts with sk-)
  4. New accounts get $5 free credit (expires after 3 months)

1. Chat Completion (GPT-4o Mini)

curl https://api.openai.com/v1/chat/completions \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {"role": "system", "content": "You are a helpful coding assistant."},
      {"role": "user", "content": "Write a Python function to check if a number is prime."}
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

GPT-4o mini costs $0.15 per million input tokens — your $5 credit = ~33 million tokens.

2. Generate Images (DALL-E 3)

curl https://api.openai.com/v1/images/generations \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A futuristic city skyline at sunset, cyberpunk style",
    "size": "1024x1024",
    "n": 1
  }'
Enter fullscreen mode Exit fullscreen mode

3. Transcribe Audio (Whisper)

curl https://api.openai.com/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-YOUR_KEY" \
  -F model="whisper-1" \
  -F file="@meeting-recording.mp3"
Enter fullscreen mode Exit fullscreen mode

4. Python — Chatbot

from openai import OpenAI

client = OpenAI(api_key="sk-YOUR_KEY")

def chat(message, history=[]):
    history.append({"role": "user", "content": message})

    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."}
        ] + history
    )

    reply = response.choices[0].message.content
    history.append({"role": "assistant", "content": reply})
    return reply

# Interactive chat
history = []
print(chat("What is web scraping?", history))
print(chat("Show me a Python example", history))
Enter fullscreen mode Exit fullscreen mode

5. Node.js — Content Generator

import OpenAI from "openai";

const openai = new OpenAI({ apiKey: "sk-YOUR_KEY" });

async function generateBlogPost(topic) {
  const response = await openai.chat.completions.create({
    model: "gpt-4o-mini",
    messages: [
      {
        role: "system",
        content: "Write a concise, engaging blog post. Use markdown formatting.",
      },
      { role: "user", content: `Write a blog post about: ${topic}` },
    ],
    max_tokens: 1000,
  });

  return response.choices[0].message.content;
}

const post = await generateBlogPost("5 tips for building REST APIs");
console.log(post);
Enter fullscreen mode Exit fullscreen mode

Pricing (Pay As You Go)

Model Input Output
GPT-4o mini $0.15/1M tokens $0.60/1M tokens
GPT-4o $2.50/1M tokens $10/1M tokens
DALL-E 3 $0.04/image (1024x1024)
Whisper $0.006/minute

With $5 free credit, GPT-4o mini alone gives you ~33 million input tokens or ~8 million output tokens.

What You Can Build

  • AI chatbot — customer support, FAQ, internal knowledge base
  • Content generator — blog posts, product descriptions, social media
  • Code assistant — explain code, write tests, debug errors
  • Image generator — marketing graphics, thumbnails, illustrations
  • Meeting transcriber — Whisper + GPT summary pipeline
  • Semantic search — embeddings + vector database for smart search

More Free API Articles


Need Web Data? Try These Tools

If you're building apps that need web scraping or data extraction, check out my ready-made tools on Apify Store — scrapers for Reddit, YouTube, Google News, Trustpilot, and 80+ more. No coding needed, just run and get your data.

Need a custom scraping solution? Email me at spinov001@gmail.com


More Free APIs You Should Know About

Need custom data scraping? Email me or check my Apify actors.

Top comments (0)