DEV Community

shashank ms
shashank ms

Posted on

Building a Content Generation Platform using LLM

Building a production content generation platform requires more than a large language model endpoint. You need an inference layer that handles long system prompts, multi-turn agentic workflows, structured output, and unpredictable context lengths without destroying your unit economics. Token-based billing penalizes exactly the patterns that make content generation useful: few-shot examples, retrieved documents, style guides, and revision loops. This guide walks through a practical architecture, model selection, and implementation patterns using an inference provider that charges per request rather than per token.

Architecture Overview

A production content platform typically separates concerns into ingestion, prompt orchestration, inference, post-processing, and delivery. The inference layer is where costs explode if your provider meters input and output tokens separately. For content workflows that pass full drafts, brand guidelines, or knowledge-base articles into the context window, request-based pricing removes the penalty on prompt length. Oxlo.ai offers this structure: one flat cost per API call regardless of how many tokens you pack into the prompt.

The stack we will assemble uses standard HTTP APIs and the OpenAI SDK, so you can prototype locally and cut over to production without rewriting client code.

Selecting the Right Model Stack

Content platforms usually need a mix of capabilities. Oxlo.ai hosts 45+ open-source and proprietary models across 7 categories with no cold starts on popular models, so you can route tasks to specialized endpoints instead of forcing one model to do everything.

  • General long-form drafting and reasoning: Llama 3.3 70B, Qwen 3 32B, GPT-Oss 120B, DeepSeek V4 Flash (efficient MoE with 1M context), Kimi K2.6 (advanced reasoning with 131K context), or GLM 5 (744B MoE for long-horizon agentic tasks).
  • Editorial planning and deep reasoning: DeepSeek R1 671B MoE, Kimi K2.5, and Kimi K2 Thinking for advanced chain-of-thought analysis.
  • Code generation: Qwen 3 Coder 30B, DeepSeek Coder, Minimax M2.5, and DeepSeek V3.2 (available on the free tier).
  • Vision: Gemma 3 27B and Kimi VL A3B for image-to-text workflows such as automatic alt-text or chart summarization.
  • Image generation: Oxlo.ai Image Pro, Oxlo.ai Image Ultra, Flux.1, and Stable Diffusion 3.5 via the images/generations endpoint.
  • Audio: Whisper Large v3 / Turbo / Medium for transcription, and Kokoro 82M for text-to-speech.

Because Oxlo.ai does not scale cost with input length, you can feed a 10,000 word style guide into the context window for every request without changing the per-call economics.

Setting Up the API Client

Oxlo.ai is fully OpenAI SDK compatible. Integration is a single base URL change.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.oxlo.ai/v1",
    api_key=os.environ.get("OXLO_API_KEY")
)

response = client.chat.completions.create(
    model="llama-3.3-70b",
    messages=[
        {"role": "system", "content": "You are a senior technical editor."},
        {"role": "user", "content": "Generate an outline for a blog post about vector databases."}
    ],
    stream=True
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Streaming responses are supported across chat models, so you can render text to the frontend as it generates.

Building the Content Pipeline

Production platforms rarely want raw prose. They need structured data. Oxlo.ai supports JSON mode and function calling, which lets you enforce schemas and attach tools for research or SEO analysis.

Example outline generation with JSON mode:

response = client.chat.completions.create(
    model="qwen-3-32b",
    messages=[
        {"role": "system", "content": "Return valid JSON with keys: title, headings, meta_description."},
        {"role": "user", "content": "Topic: request-based pricing for LLM inference."}
    ],
    response_format={"type": "json_object"}
)

outline = response.choices[0].message.content

For multi-step editorial workflows, use multi-turn conversations or function calling to chain research, drafting, and revision. On a token-based provider, each turn adds cost proportional to the growing conversation history. On Oxlo.ai, each turn is one flat request. This makes agentic content pipelines significantly cheaper to operate at scale.

Handling Long-Form and Agentic Workloads

Long-form articles often require multiple model calls: keyword research, outline generation, section drafting, fact checking, and tone adjustment. When each call carries a large system prompt and prior context, token-based billing accumulates fast. Oxlo.ai's request-based pricing means a 1,000 token prompt and a 100,000 token prompt cost the same per call.

This pricing model is particularly effective for:

  • SEO platforms that inject retrieved top-ranking articles into the prompt.
  • Report generators that include large CSV or PDF context.
  • Agentic editors that maintain long conversation histories across revision rounds.

Models such as DeepSeek V4 Flash (1M context) and Kimi K2.6 (131K context) give you the window space to implement these patterns without watching metered costs scale linearly with document length.

Adding Multi-Modal Capabilities

Modern content is not only text. Oxlo.ai provides vision models and image generation endpoints that integrate into the same OpenAI-compatible client.

Vision input for automatic alt-text or asset analysis:

response = client.chat.completions.create(
    model="kimi-k2-6",
    messages=[
        {"role": "user", "content": [
            {"type": "text", "text": "Write alt-text for this image."},
            {"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
        ]}
    ]
)

For hero images or social assets, call the images/generations endpoint with Oxlo.ai Image Pro, Ultra, Flux.1, or Stable Diffusion 3.5. For audio workflows, use Whisper via audio/transcriptions or Kokoro via audio/speech.

Cost Control and Scaling

Predictable pricing matters for content platforms because request volume scales with user count. Oxlo.ai offers tiered plans:

  • Free: $0 per month, 60 requests per day, 16+ free models, plus a 7-day full-access trial.
  • Pro: $80 per month, 1,000 requests per day, all models.
  • Premium: $350 per month, 5,000 requests per day, all models, priority queue.
  • Enterprise: Custom pricing, unlimited requests, dedicated GPUs, and guaranteed 30% savings versus your current provider.

Because the platform does not charge by token, you can increase prompt complexity, add few-shot examples, and expand context windows without redesigning your budget. See https://oxlo.ai/pricing for current plan details.

Putting It All Together

A minimal but production-ready content generation architecture looks like this:

  1. Accept a content brief via your API.
  2. Retrieve reference documents and brand style guide.
  3. Use Llama 3.3 70B or Qwen 3 32B via Oxlo.ai to generate a structured outline in JSON mode.
  4. Iterate through sections using multi-turn chat or parallel requests.
  5. Pass source images through Gemma 3 27B or Kimi VL A3B if visual context is required.
  6. Generate hero images via Oxlo.ai Image Pro or Flux.1.
  7. Assemble and deliver the final asset to your CMS.

With full OpenAI SDK compatibility, you can prototype against OpenAI locally and switch base_url to https://api.oxlo.ai/v1 for production without rewriting client logic.

Next Steps

Start with the Free tier to benchmark output quality on your existing prompts. Measure latency on long-context calls and compare your monthly inference bill. If your platform relies on agentic workflows, large retrieved contexts, or long system prompts, the request-based model will likely reduce costs. For dedicated throughput and custom contracts, contact Oxlo.ai for an Enterprise plan.

Top comments (0)