We will build a command-line copywriter agent that turns a product name and raw feature notes into polished marketing copy. This is useful for developers and founders who need to generate listing descriptions, landing page blurbs, or ad text without maintaining a token budget. We will wire it to Oxlo.ai so every request costs the same regardless of how many features the user pastes in.
What you'll need
- Python 3.10 or newer installed locally.
- The OpenAI SDK. Install it with
pip install openai. - An Oxlo.ai API key from https://portal.oxlo.ai. The free tier is enough to follow along.
1. Wire up the Oxlo.ai client
First, confirm that your environment can reach Oxlo.ai. This script imports the SDK, points the base URL to Oxlo.ai, and sends a single test message.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
SYSTEM_PROMPT = "You are a helpful assistant."
user_message = "Say hello and confirm the connection works."
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message},
],
)
print(response.choices[0].message.content)
2. Lock in the system prompt
The system prompt is the only tuning lever we need. It keeps the output concise and on brand.
SYSTEM_PROMPT = """You are a direct-response copywriter.
Given a product name and a short list of features, write a concise, punchy product description of three to four sentences.
Avoid fluff. Focus on the user benefit."""
3. Build the generator function
Now we package the call into a function that accepts dynamic inputs. This is the core of the agent.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
SYSTEM_PROMPT = """You are a direct-response copywriter.
Given a product name and a short list of features, write a concise, punchy product description of three to four sentences.
Avoid fluff. Focus on the user benefit."""
def generate_description(product_name, features):
user_message = f"Product: {product_name}\nFeatures: {features}"
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message},
],
)
return response.choices[0].message.content.strip()
4. Add an interactive loop
A loop lets us test multiple products without restarting the script. We collect input, call the function, and print the result.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
SYSTEM_PROMPT = """You are a direct-response copywriter.
Given a product name and a short list of features, write a concise, punchy product description of three to four sentences.
Avoid fluff. Focus on the user benefit."""
def generate_description(product_name, features):
user_message = f"Product: {product_name}\nFeatures: {features}"
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message},
],
)
return response.choices[0].message.content.strip()
if __name__ == "__main__":
print("Copywriter Agent")
print("Type 'quit' to exit.\n")
while True:
product = input("Product name: ").strip()
if product.lower() == "quit":
break
features = input("Feature list (comma separated): ").strip()
if features.lower() == "quit":
break
print("\nDrafting...\n")
copy = generate_description(product, features)
print(copy)
print("-" * 40)
Run it
Save the file as copywriter.py, then run it from your terminal:
python copywriter.py
Example session:
Copywriter Agent
Type 'quit' to exit.
Product name: Oxlo.ai Inference API
Feature list: flat per-request pricing, 45+ models, no cold starts
Drafting...
Stop worrying about token counts. Oxlo.ai gives you one flat price per API request no matter how long your prompt is, with 45+ open-source and proprietary models ready instantly. It is a drop-in replacement for your existing OpenAI SDK code, so you can ship faster without rewriting your stack.
----------------------------------------
Product name:
Wrap-up
You now have a working copywriter agent that runs against Oxlo.ai. Because the platform uses request-based pricing, you can paste in a hundred feature bullets or a single sentence and the cost stays the same. See https://oxlo.ai/pricing for current plan details.
Two concrete ways to push this further: switch the response format to JSON mode so you get structured fields like headline, body, and CTA, or swap the model to kimi-k2.6 or deepseek-v3.2 if you want to experiment with stronger reasoning or coding-aware copy on Oxlo.ai.
Top comments (0)