ALL BUSINESS
COMIDA
DIRECTORIES
ENTERTAINMENT
FINER THINGS
FREE CREATOR TOOLS
HEALTH
MARKETPLACE
MEMBER's ONLY
MONEY MATTER$
MOTIVATIONAL
NEWS & WEATHER
TECHNOLOGIA
TV NETWORKS
VIDEOS
VOTE USA 2026/2028
INVESTOR RELATIONS
Posted by - Latinos MediaSyndication -
on - March 18, 2023 -
Filed in - Marketing -
-
491 Views - 0 Comments - 0 Likes - 0 Reviews
ChatGPT announced the rollout of its API (GPT 3.5 Turbo) on March 1.
I’m bullish on ChatGPT’s utility for several different SEO-related functions like keyword research, local SEO, content, and link building. Having spent much time using ChatGPT, I’m also painfully aware of its limitations.
While the API won’t be a panacea (and the web interface is actually much better for some tasks), it can help address some of the shortcomings of the web interface.
This article will show you how to maximize ChatGPT’s API with specific SEO use cases.
How to use the ChatGPT APITo leverage the ChatGPT API, you need to be able to access the API in the first place. ChatGPT’s parent company OpenAI has extensive documentation for using the API.
If you’re looking to learn more about building a tool or interacting directly with the API there’s also a good walk-through here.
You can also use AppsScript to query the ChatGPT API in Google Sheets, which we’ll walk through here step by step.
Regardless of your approach, you’ll need to start by getting an API key.
Getting your ChatGPT API keyOnce you have an OpenAI account, you can generate your API key either by following this link while logged in or clicking View API keys in the profile dropdown:
Then click Create new secret key.
Copy the API key you generated.
There’s a straightforward way to connect ChatGPT to Google Sheets (h/t Keith Mint).
First, create a new Google Sheet, then click on Extensions and choose Apps Script:
You then paste the following code (with your API key in place of YOUR API KEY):
const SECRET_KEY = "YOUR API KEY"; const MAX_TOKENS = 800; const TEMPERATURE = 0.9; function AI_ChatGPT(prompt, temperature = 0.4, model = "gpt-3.5-turbo") { const url = "https://api.openai.com/v1/chat/completions"; const payload = { model: model, messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: prompt }, ], temperature: TEMPERATURE, max_tokens: MAX_TOKENS, }; const options = { contentType: "application/json", headers: { Authorization: "Bearer " + SECRET_KEY }, payload: JSON.stringify(payload), }; const res = JSON.parse(UrlFetchApp.fetch(url, options).getContentText()); return res.choices[0].message.content.trim(); }
Click save within Apps Script:
Then you can use the following function format to apply a prompt to a cell:
=AI_ChatGPT("YOUR PROMPT HERE")
As Mint points out in his article, you can also reference a cell if you want to have multiple cells use prompts that refer back to one cell (like the title or topic of a blog post):
In the example above, I used simple prompts like the one pictured, then created a second paragraph for this topic. (We’ll walk through more specific applications for the API shortly.)
ChatGPT API pricingBefore you start leveraging the ChatGPT API for SEO tasks, it’s essential to understand the pricing.
The price for the gpt-3.5-turbo API (the ChatGPT API) is $0.002 per 1,000 tokens, which is 10x cheaper than the existing GPT-3.5 API.
To better understand what the pricing actually winds up looking like, you need to understand how tokens work.
ChatGPT API tokensOpenAI has a good breakdown and a helpful free tokenizer tool to help you determine how many tokens a specific text will be and how the text is broken down (in case you need to reduce the number of tokens for a prompt or response).
A few key things to keep in mind:
OpenAI also provided this helpful breakdown of how tokens are calculated from text:
Or
To get additional context on how tokens stack up, consider this:
So if you used a short prompt to generate a 1,500-word article, it would be less than half a cent.
Specific API use cases for SEOThe API can help with a lot of the same SEO-related tasks as the ChatGPT web interface, but the two have some significant differences, making some tasks better for one than the other.
Understanding that will help you determine which to use for SEO tasks.
ChatGPT API vs. web interfaceThe biggest differences include the following:
Scale and bulk tasks
If you want to integrate ChatGPT with an existing application or spreadsheet, you'll need to use the API.
Additionally, the API will be your friend if you want to perform a specific function applied across multiple instances (e.g., generate meta descriptions for several keywords).
Fine-tuning and relationship between prompts
Currently, ChatGPT's API does not support fine-tuning. If you create multiple prompts through the API, they won't have a relationship.
You can create a system message to apply to multiple prompts and responses, but OpenAI has said that these are frequently currently ignored by the gpt-3.5-turbo API.
This means if you have a task that requires several prompts and for ChatGPT to keep the context of an entire conversation, you'll want to use the web interface.
Character limits
The API has a token limit of 4,096 which translates to around 16,384 characters per interaction for each prompt and response.
Character limits for the web interface can vary, but generally, the prompt and response are limited to around 2,048 characters, or 4,096.
So for tasks that require more extensive prompts or more significant responses, the API will be a better option.
There are also more options for structuring prompts and tasks in a way that gives you a lengthier combined output if you're using code rather than something like the Google Sheets integration.
Pricing
Again, the API is priced by usage (and offers a free trial with $18 worth of tokens), and the web interface currently offers a free version and a $20/mo. paid version.
Example ChatGPT API promptsLet's look at specific use cases where you'd want to consider the API over the web interface.
Title tags and meta descriptionsAn obvious use case where the API makes sense is having ChatGPT generate title tags or meta descriptions at scale.
You can use similar prompts to those that work in the web interface here, but if you structure them properly and lay out your spreadsheet right, you can take the first prompt and then quickly apply that to several URLs or keywords:
Note that the free plan particularly is rate limited, so you may have errors where the cells time out, in which case you need to delete and re-paste:
And as always, keep in mind that:
You can use this same format for title tags. (I'll have an article focusing specifically on using ChatGPT to generate and update title tags coming out soon).
Longer content and post outlinesYou can use the web interface in ChatGPT to create chunks of content and outlines pretty easily.
If you want to make a longer article or if you're going to create a series of outlines on different topics, however, it can be a clunky experience.
The API is smoother for these tasks.
First, you can chunk off a post you wrote into sections. Then line up the sections and pull your prompt down:
Alternatively, you could have ChatGPT generate several outlines that you then have a writer (or writers) fill in:
Then, you could have the API write the content one section at a time:
Again, here you could take these prompts, load them one by one across the outline (changing each prompt for the appropriate section), and then just pull the same formulas across multiple outlines and have a lot of text specific to the subsections of each post generated.
My experience is that this helps you steer clear of token limits, and even pedestrian prompts like the one above combined with having ChatGPT create an outline will generate better content than if you ask the tool to "write a blog post."
Beyond that, you can further improve content quality by doing things like:
And, as always, layer on human editing.
FAQsThere are multiple FAQ-related functions the API can help with.
First off, you can generate a list of FAQ questions to be associated with a blog post:
Next, you can have the ChatGPT API answer these (again: proceed with caution when it comes to output quality and accuracy):
You can also have ChatGPT..