From Full Stack to AI: API Setup and Integration
From Full Stack to AI: API Setup and Integration

I’m a full-stack developer who enjoys building practical, scalable applications with React.js, Node.js, and Next.js. My journey into open source started with Hacktoberfest 2023, and it opened the door to real collaboration, learning from global contributors, and supporting early developers as they grow.
Since then, I’ve contributed to and mentored in programs like GSSoC’24, SSOC’24, and C4GT’24. As a Google Gen AI Exchange Hackathon ’24 Finalist and a Google Women Techmakers Ambassador, I’ve had the chance to help communities explore AI and build meaningful solutions. I’m also part of the Top 1% mentors on Topmate, where I guide students on open source, career building, and technical growth.
My work has been featured at Times Square NYC, and I’ve spoken on international podcasts about tech, learning, and community. I’ve also written technical content for CoderArmy and continue to share insights through articles and public posts. LinkedIn has recognized my work with seven Top Voice badges as well as Golden Badges in research, critical thinking, teamwork, and interpersonal skills.
I completed my MCA from Chandigarh University in 2023 and continue to stay curious by exploring AI, building new projects, and contributing to developer communities. Whether it’s improving a UI, debugging backend logic, or helping someone with their first pull request, I enjoy learning alongside others.
If you want to collaborate, learn together, or discuss an idea, feel free to reach out at kumaripayal7488@gmail.com
When you move from full stack development into AI, the first real hands on step is calling an AI model from your own code. This chapter focuses on exactly that. No theory, no heavy math. Just setting up accounts, connecting APIs, and getting real responses using Python.
If you have built REST APIs or consumed third party services before, this will feel familiar. AI APIs work in a very similar way.
1. Configuring Your OpenAI Account
What this step means
Before you can call OpenAI models, you need an API key. This key is how OpenAI knows who you are and how to bill usage. Think of it like any other service API key you have used before.
What you need to do
Create an OpenAI account :- OpenAI platform
https://openai.com/Generate an API key from the dashboard
Store the key securely, usually as an environment variable
Example using environment variables:
export OPENAI_API_KEY="your_api_key_here"
Why this matters
Hard coding API keys inside code is risky. Using environment variables keeps your credentials safe and follows good engineering practices.
2. Invoking OpenAI APIs with Python
What this does
This is the simplest possible example of sending text to an OpenAI model and getting a response back. The model reads your input and generates text based on it.
Python example
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-5.2",
input="Write a short bedtime story about a unicorn."
)
print(response.output_text)
Example output
Once upon a time, a gentle unicorn lived in a quiet forest and helped other animals feel safe at night.
Explanation
You sent a plain text prompt to the model. The model predicted the next tokens and returned a complete response. The output_text field already combines everything into readable text.
If you have used APIs like Stripe or Firebase, this pattern should feel very familiar.
3. Creating and Setting Up a Google Gemini Account
What is Gemini?
Gemini is Google’s family of generative AI models. Like OpenAI models, Gemini can generate text, explain concepts, and answer questions.
Google AI Studio (Gemini)
https://aistudio.google.com/
Basic Python example
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents="Explain how AI works in a few words"
)
print(response.text)
Example output
AI learns patterns from data and uses them to make predictions or generate responses.
Explanation
The flow is very similar to OpenAI. You create a client, send a prompt, and read the generated text. Once you understand one API, learning the other becomes much easier.
4. Using Google Gemini with OpenAI Compatible APIs
Why this is useful
Some teams already use the OpenAI SDK in their projects. Gemini now supports OpenAI compatible APIs, which means you can switch models without rewriting all your code.
Gemini OpenAI compatible API docs
https://ai.google.dev/gemini-api/docs/openai
Python example using OpenAI style syntax
from openai import OpenAI
client = OpenAI(
api_key="gemini_api_key",
base_url="https://generativelanguage.googleapis.com/v1beta/"
)
response = client.chat.completions.create(
model="gemini-1.5-flash",
n=1,
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{
"role": "user",
"content": "Explain to me how AI works"
}
]
)
print(response.choices[0].message)
Example output
AI works by learning patterns from data and using those patterns to generate answers or predictions.
Explanation
Here, the OpenAI client is used to talk to Gemini instead of OpenAI. The only changes are the API key, base URL, and model name. This makes experimentation much easier for developers.
Closing Thoughts
API setup and integration is where AI starts feeling real for full stack developers. Once you can call a model, you can plug AI into forms, APIs, dashboards, and background jobs.
Learn one provider well, understand the request and response flow, and then explore others. Strong foundations make everything else easier.





