Development of an AI-Powered Ad Copy Generation System
Imagine launching a campaign on Yandex.Direct and Google Ads simultaneously. Manually writing 100+ unique ads while respecting character limits and brand tone—that's a week of routine. And even then, 4 out of 5 variants fail to deliver the expected CTR. We've been through this with dozens of clients and built a system on GPT-4o that generates hundreds of variants in minutes, accounting for each platform's constraints. Turnkey—from audit to integration with ad accounts.
Typical Problems the System Solves
Problem #1: Platform limits. Yandex.Direct cuts headlines after 35 characters, Google Ads after 30. Manual adjustment eats hours, and the result still suffers. We hardcode these rules directly into the prompt: the model "knows" the maximums and generates texts strictly within bounds.
Problem #2: Bloated A/B test budget. A copywriter produces 10 variants per day—too few for statistical significance. Our system outputs 100+ variants per minute, which is 14,400x faster (100/min vs 10/day), allowing you to test 50+ combinations in an hour and quickly find the winner.
Problem #3: Loss of brand tone. Without fine-tuning, the model easily generates generic phrases. We add a slot for brand tone and use RAG to pull context from your past campaigns.
How the System Ensures Platform Constraint Compliance
Each platform dictates rigid limits: headline length, description character count, available CTAs. We hardcode these rules directly into the prompt—the model "knows" that for Yandex.Direct the headline max is 35 characters, for Google Ads it's 30. No truncated phrases, no manual rework.
from openai import AsyncOpenAI
from dataclasses import dataclass
client = AsyncOpenAI()
@dataclass
class AdBrief:
product: str
usp: str # unique selling proposition
target_audience: str
pain_points: list[str]
platform: str # google_search, yandex_direct, vk, telegram, instagram
goal: str # clicks, conversions, awareness, app_install
brand_tone: str = "professional"
PLATFORM_CONSTRAINTS = {
"google_search": {
"headline_max": 30,
"headline_count": 15,
"description_max": 90,
"description_count": 4
},
"yandex_direct": {
"headline_max": 35,
"headline_count": 8,
"description_max": 81,
"description_count": 2
},
"vk": {
"headline_max": 50,
"body_max": 220,
"cta_options": ["Подробнее", "Купить", "Записаться", "Узнать больше", "Попробовать"]
},
"telegram": {
"title_max": 50,
"description_max": 160,
"button_text_max": 25
}
}
async def generate_ad_copy(
brief: AdBrief,
num_variants: int = 5
) -> list[dict]:
constraints = PLATFORM_CONSTRAINTS.get(brief.platform, {})
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{
"role": "system",
"content": f"""You are a Performance Marketer, specialist in copywriting for {brief.platform}.
Create {num_variants} ad copy variants.
Platform constraints:
{json.dumps(constraints, ensure_ascii=False)}
Principles:
- Specific over generic ("save 30 min/day" > "save time")
- Benefit in headline, not feature
- Triggers: urgency, social proof, FOMO
- Clear CTA
- No clichés: "best", "unique", "innovative"
Return JSON array of variants."""
}, {
"role": "user",
"content": f"""
Product: {brief.product}
USP: {brief.usp}
Target audience: {brief.target_audience}
Pain points: {', '.join(brief.pain_points)}
Goal: {brief.goal}
Tone: {brief.brand_tone}
"""
}],
response_format={"type": "json_object"}
)
return json.loads(response.choices[0].message.content)["variants"]
Why Use AI Generation Instead of a Copywriter?
Compare: a copywriter writes 10 variants per day, AI writes 100 per minute (14,400x faster). GPT-4o costs 5–10 times less and requires no revision cycles. API costs are as low as $0.01 per 1,000 tokens, saving up to $5,000 per month in copywriting expenses. But most importantly, it never tires and never forgets platform constraints. In one project, the system increased CTR by 35% by automatically A/B testing 40 headline variants. Let's assess your project—contact us, and we'll choose the optimal stack for your tasks.
Landing Page Section Generator
LANDING_SECTIONS = {
"hero": "headline + subheadline + CTA button",
"problem": "description of problem we solve",
"solution": "how product solves the problem",
"features": "3-5 key features with description",
"social_proof": "testimonials, cases, numbers",
"faq": "5-7 questions and answers",
"cta": "final call to action"
}
async def generate_landing_copy(brief: AdBrief) -> dict:
sections = {}
for section_name, section_desc in LANDING_SECTIONS.items():
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{
"role": "system",
"content": f"Write a landing section: {section_desc}. No template phrases. Be specific and on point."
}, {
"role": "user",
"content": f"Product: {brief.product}. USP: {brief.usp}. Target audience: {brief.target_audience}."
}]
)
sections[section_name] = response.choices[0].message.content
return sections
Platform Text Requirements
| Platform | Headline max | Description max | CTA button max |
|---|---|---|---|
| Google Ads | 30 chars | 90 chars | — |
| Yandex.Direct | 35 chars | 81 chars | — |
| VK | 50 chars | 220 chars | 25 chars |
| Telegram | 50 chars | 160 chars | 25 chars |
| Parameter | Manual Copywriting | AI System |
|---|---|---|
| Production speed | 10–20 variants/day | 100+ variants/minute |
| A/B testing | 2–3 variants/week | 50+ variants per hour |
| Format compliance | Requires checking | Automatic |
How We Incorporate Brand Tone
To preserve your brand's unique voice, we fine-tune on your historical data—up to 1000 text examples. Adaptation is done via LoRA adapters, reducing cost to 5% of full fine-tuning. If data is scarce, we use RAG: the model pulls relevant snippets from your text library (emails, posts, landing pages). We also leverage few-shot learning and chain-of-thought reasoning to maintain consistency. This ensures generated text sounds like your brand, not an average copywriter.
Text Quality Scoring Module
To select the best variants before launch, we embed a scoring module based on GPT-4o. It analyzes each variant on five criteria: audience relevance, clarity, urgency, specificity, and CTA strength. Each criterion is scored 1–10. Based on the total, the model predicts CTR potential (low/medium/high). This filters out weak variants before they reach the ad account.
async def score_ad_copy(copy_variants: list[dict], brief: AdBrief) -> list[dict]:
"""Score each variant on key metrics"""
response = await client.chat.completions.create(
model="gpt-4o",
messages=[{
"role": "system",
"content": f"""Score ad copies for {brief.platform}.
Evaluation criteria (each 1-10):
- relevance_to_audience
- clarity
- urgency
- specificity
- cta_strength
Predict CTR potential: low/medium/high.
Return JSON array of scores."""
}, {
"role": "user",
"content": f"Variants:\n{json.dumps(copy_variants, ensure_ascii=False)}\n\nProduct: {brief.product}, Target audience: {brief.target_audience}"
}],
response_format={"type": "json_object"}
)
scores = json.loads(response.choices[0].message.content)["scores"]
for i, variant in enumerate(copy_variants):
if i < len(scores):
variant["scores"] = scores[i]
return copy_variants
What's Included in the Work
- Audit of current ad campaigns — briefs, tone, performance. We evaluate text volume, typical mistakes, and growth areas.
- Architecture design — model selection (GPT-4o/Claude 3.5), prompt engineering, brand context slot. Determine if fine-tuning or RAG is needed.
- Generator development — implement modules: platform-specific generation, landing pages, quality scoring. Write code in Python with async requests. We set temperature parameters and token limits to balance creativity and precision.
- Integration with ad accounts — connect to Google Ads API, Yandex.Direct API, Telegram Ads. Automatically upload texts on schedule.
- Testing and calibration — generate 500+ variants, measure CTR, adjust scoring weights. Iteratively improve quality.
- Deployment and documentation — deploy on your server or cloud, provide README, Swagger specification, train your team.
Timeline: basic module — from 1 week, full platform — up to 4 weeks. Contact us to evaluate your project — we'll pick the optimal stack and estimate cost within 1 day. Guaranteed stable operation and support at all stages.
Additionally, we leverage cutting-edge LLM techniques—fine-tuning on your historical data, RAG for brand context, and LoRA adapters for cost efficiency. Our team has 5+ years in machine learning and 20+ projects in ad automation. Order implementation and get a consultation on your project.







