We are going to build a command-line content generation platform that turns a technical topic into a publish-ready blog post with an outline, SEO metadata, and formatted markdown. This is for engineering teams who want to automate long-form content without managing token budgets or context-window math. Because Oxlo.ai charges a flat rate per request rather than per token, running a long system prompt plus a multi-section article costs the same as a short chat, which makes this workload predictable.
What you'll need
- Python 3.10 or newer
- The OpenAI SDK:
pip install openai - An Oxlo.ai API key from https://portal.oxlo.ai
Step 1: Initialize the Oxlo.ai client
First, import the SDK and point it to Oxlo.ai. This is a drop-in replacement for the standard OpenAI client.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
Step 2: Define the content schema and system prompt
I treat the outline as structured data so downstream steps can consume it programmatically. The system prompt forces JSON output without markdown fences.
import json
SYSTEM_PROMPT = """You are a senior technical content strategist.
Given a topic, return strictly valid JSON with these keys:
- title: string, SEO-friendly and under 60 characters
- keywords: array of 5 strings
- outline: array of objects, each with heading and subpoints
- target_word_count: integer around 800
Output only the JSON object, no markdown fences."""
Step 3: Generate the outline and metadata
I use DeepSeek V3.2 here because its reasoning capabilities handle structured instructions reliably, and it sits on Oxlo.ai's free tier so you can experiment without burning a budget.
def generate_outline(topic):
response = client.chat.completions.create(
model="deepseek-v3.2",
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": f"Topic: {topic}"},
],
response_format={"type": "json_object"},
temperature=0.7,
)
return json.loads(response.choices[0].message.content)
outline = generate_outline("Building resilient microservices with Kubernetes")
print(json.dumps(outline, indent=2))
Step 4: Write the article body section by section
With the outline in hand, I loop through each heading and generate prose. I use Llama 3.3 70B for the body because it is Oxlo.ai's general-purpose flagship and produces consistent long-form technical text.
SECTION_PROMPT = """You are an experienced technical writer.
Write the section heading provided by the user in about 150 to 200 words.
Use clear examples. Return plain markdown."""
def write_section(heading, context):
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": SECTION_PROMPT},
{"role": "user", "content": f"Context: {context}\n\nSection: {heading}"},
],
temperature=0.8,
)
return response.choices[0].message.content
sections = []
for item in outline["outline"]:
text = write_section(item["heading"], outline["title"])
sections.append(f"## {item['heading']}\n\n{text}\n")
body = "\n".join(sections)
print(body[:500])
Step 5: Assemble and save the final post
Finally, I wrap the metadata and body into a markdown file with YAML front matter.
def assemble_post(outline, body):
front_matter = f"""---
title: "{outline['title']}"
keywords: {', '.join(outline['keywords'])}
---
# {outline['title']}
{body}
"""
with open("article.md", "w") as f:
f.write(front_matter)
return front_matter
final = assemble_post(outline, body)
print("Saved to article.md")
Run it
Save the full script as content_platform.py, export your key, and run it.
export OXLO_API_KEY="YOUR_OXLO_API_KEY"
python content_platform.py
Example output from the outline step:
{
"title": "Building Resilient Microservices with Kubernetes",
"keywords": [
"kubernetes",
"microservices",
"resilience",
"container orchestration",
"cloud native"
],
"outline": [
{
"heading": "Introduction to Microservices Resilience",
"subpoints": [
"Define resilience in distributed systems",
"Why Kubernetes is the default substrate"
]
},
{
"heading": "Health Checks and Self-Healing Pods",
"subpoints": [
"Liveness versus readiness probes",
"Restart policies and backoff loops"
]
}
],
"target_word_count": 800
}
Wrap-up and next steps
Two concrete next steps. First, add a review pass using Kimi K2.6 to score each section for clarity and technical accuracy before assembly. Second, parallelize the section writers with asyncio or concurrent.futures, because Oxlo.ai has no cold starts on popular models so you can fire many requests at once without penalty.
Top comments (0)