Documentation Index
Fetch the complete documentation index at: https://docs.kymaapi.com/llms.txt
Use this file to discover all available pages before exploring further.
Best Model for This
| Model | Why | Cost per article |
|---|
deepseek-v3 | GPT-5 class quality, best value | ~$0.004 |
qwen-3.6-plus | Most creative, best prose | ~$0.003 |
llama-3.3-70b | Fastest for high-volume batches | ~$0.006 |
Costs assume ~500 tokens input + ~800 tokens output per article.
Quick Start
import json
import asyncio
from openai import AsyncOpenAI
client = AsyncOpenAI(
base_url="https://kymaapi.com/v1",
api_key="ky-your-api-key"
)
async def generate_article(topic: str) -> dict:
# Step 1: Generate structured outline
outline_resp = await client.chat.completions.create(
model="deepseek-v3",
messages=[{
"role": "user",
"content": f"Create a blog post outline for: {topic}. "
"Return JSON: {{\"title\": str, \"sections\": [str]}}"
}],
response_format={"type": "json_object"},
temperature=0.7
)
outline = json.loads(outline_resp.choices[0].message.content)
# Step 2: Expand each section
sections = []
for section in outline["sections"]:
resp = await client.chat.completions.create(
model="deepseek-v3",
messages=[{"role": "user", "content": f"Write 2 paragraphs for: {section}"}],
temperature=0.8
)
sections.append(resp.choices[0].message.content)
return {"title": outline["title"], "sections": sections}
# Batch multiple articles in parallel
topics = ["AI in healthcare", "Future of remote work", "Climate tech startups"]
articles = asyncio.run(asyncio.gather(*[generate_article(t) for t in topics]))
for a in articles:
print(f"# {a['title']}\n")
Tips & Best Practices
- Use
response_format: json_object — guarantees valid JSON output, no need to parse freeform text.
- Temperature 0.7–0.9 for creative content — lower temperatures produce repetitive, generic prose.
- Batch with
asyncio.gather / Promise.all — parallel generation cuts wall-clock time by 5-10x.
- Two-pass pipeline beats one big prompt — outline first, then expand. Better structure, more coherent output.
Cost Estimate
| Volume | Model | Monthly cost |
|---|
| 100 articles/day | deepseek-v3 | ~$12/month |
| 1K articles/day | deepseek-v3 | ~$120/month |
| 1K articles/day | llama-3.3-70b | ~$180/month |
Assumes 500 tokens input + 800 tokens output per article (outline + full content, two API calls).
Next Steps