We are building a product copy generator that turns rough specs into polished marketing text, ad headlines, and social captions. It helps small e-commerce teams automate the most repetitive part of catalog management. The whole pipeline runs on Oxlo.ai, so you pay one flat cost per request regardless of how long your style guide or product specs are.
What you'll need
Grab Python 3.10 or newer, install the OpenAI SDK, and create an API key in the Oxlo.ai portal. You will not need any other providers.
pip install openai
Step 1: Connect to Oxlo.ai
I start every project with a small connectivity check. This confirms the key and base URL are correct before I build around them.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say 'Connection OK'"},
],
)
print(response.choices[0].message.content)
Step 2: Lock down the system prompt
Natural language generation lives or dies by the system prompt. I treat it as config, not code, and keep it in its own variable so non-engineers can edit it later.
SYSTEM_PROMPT = """You are a senior e-commerce copywriter.
A user will send raw product specs.
Respond with a single JSON object containing exactly these keys:
- description: a 50-word product description paragraph.
- ad_headline: a 30-character max Google ad headline.
- social_caption: a casual Instagram caption with one emoji.
Do not wrap the JSON in markdown code fences."""
Step 3: Build the generator function
This function takes raw specs, sends them to Oxlo.ai, and parses the JSON response. I use Llama 3.3 70B here because it follows structured instructions reliably, but you can swap in Qwen 3 32B or Kimi K2.6 if you need multilingual or vision support later.
import json
def generate_copy(raw_specs: str) -> dict:
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": raw_specs},
],
response_format={"type": "json_object"},
temperature=0.7,
)
content = response.choices[0].message.content
return json.loads(content)
Step 4: Batch process a catalog
In production you are never generating one item at a time. I loop over a list of products and accumulate the results. Because Oxlo.ai charges per request, I know the cost of this entire batch upfront instead of counting tokens.
products = [
"Name: Terra Hiker Boots. Specs: Waterproof leather, Vibram sole, 400g weight, sizes 7-13. Audience: trail runners.",
"Name: Aero Brew Kettle. Specs: 1.2L stainless steel, gooseneck spout, thermometer built-in. Audience: home baristas.",
]
catalog = []
for specs in products:
item = generate_copy(specs)
item["source_specs"] = specs
catalog.append(item)
with open("catalog_copy.json", "w") as f:
json.dump(catalog, f, indent=2)
Run it
Save the script as generate_copy.py, export your key, and run it.
export OXLO_API_KEY="sk-oxlo.ai-..."
python generate_copy.py
For the Terra Hiker Boots input, you should see output similar to this:
[
{
"description": "Tackle any trail in the Terra Hiker Boots. Crafted with waterproof leather and a grippy Vibram sole, these 400g hikers deliver comfort and protection in sizes 7 through 13.",
"ad_headline": "Trail-Ready Waterproof Boots",
"social_caption": "Mud, rain, or shine, your feet stay dry. Meet the Terra Hiker Boots. 🥾",
"source_specs": "Name: Terra Hiker Boots..."
}
]
Next steps
Wire this generator into a CMS webhook so new products are auto-published with copy. If you want to inject a long brand voice guide or example corpus into the system prompt, Oxlo.ai's flat per-request pricing makes that cheap compared to token-based providers. See the pricing page to pick a plan that matches your volume.
Top comments (0)