> ## 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.

# Automation Workflows

> Automate repetitive tasks with AI — email drafts, data processing, notifications, and more.

## Best Model

**Qwen 3.6 Plus** (`qwen-3.6-plus`) — Best overall quality for varied automation tasks. \~\$0.75 per 1K requests.

For high-volume, low-cost automation: **Gemini 2.5 Flash** (`gemini-2.5-flash`) or **Qwen 3 32B** (`qwen-3-32b`) depending on context needs.

## Python — Email Automation

```python theme={null}
from openai import OpenAI

client = OpenAI(base_url="https://kymaapi.com/v1", api_key="ky-your-key")

def draft_reply(email_body: str) -> str:
    response = client.chat.completions.create(
        model="qwen-3.6-plus",
        messages=[
            {"role": "system", "content": "Draft a professional reply to this email. Be concise and friendly."},
            {"role": "user", "content": email_body}
        ]
    )
    return response.choices[0].message.content

# Process incoming emails
emails = ["Can we reschedule our meeting?", "Please send the Q2 report"]
for email in emails:
    print(draft_reply(email))
```

## Python — Batch Data Processing

```python theme={null}
import json
from openai import OpenAI

client = OpenAI(base_url="https://kymaapi.com/v1", api_key="ky-your-key")

def classify_ticket(ticket: str) -> dict:
    response = client.chat.completions.create(
        model="qwen-3-32b",  # fast + structured classification
        messages=[
            {"role": "system", "content": "Classify this support ticket. Return JSON: {\"category\": \"...\", \"priority\": \"low|medium|high\", \"summary\": \"...\"}"},
            {"role": "user", "content": ticket}
        ],
        response_format={"type": "json_object"}
    )
    return json.loads(response.choices[0].message.content)

tickets = [
    "My payment failed and I can't access my account",
    "How do I change my email address?",
    "Your API has been down for 2 hours, this is critical"
]

for ticket in tickets:
    result = classify_ticket(ticket)
    print(f"[{result['priority']}] {result['category']}: {result['summary']}")
```

## JavaScript — Scheduled Reports

```typescript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://kymaapi.com/v1",
  apiKey: process.env.KYMA_API_KEY,
});

async function generateReport(data: string): Promise<string> {
  const response = await client.chat.completions.create({
    model: "qwen-3.6-plus",
    messages: [
      { role: "system", content: "Analyze this data and write a brief executive summary with key insights and action items." },
      { role: "user", content: data },
    ],
  });
  return response.choices[0].message.content!;
}

// Run daily via cron
const metrics = "Users: 1,200 (+15%), Revenue: $5,400 (+8%), Churn: 2.1% (-0.3%)";
console.log(await generateReport(metrics));
```

## Tips

* Use `qwen-3-32b` for high-volume structured tasks (classification, extraction)
* Use `qwen-3.6-plus` when quality matters (emails, reports, summaries)
* Add `response_format: {"type": "json_object"}` for structured output
* Batch requests where possible to reduce latency overhead

## Cost Estimate

| Workflow              | Volume  | Model         | Daily Cost |
| --------------------- | ------- | ------------- | ---------- |
| Email drafts          | 50/day  | qwen-3.6-plus | \~\$0.04   |
| Ticket classification | 500/day | qwen-3-32b    | \~\$0.18   |
| Daily reports         | 5/day   | qwen-3.6-plus | \~\$0.004  |

## Next Steps

* [Data Extraction](/guides/use-cases/data-extraction) — structured data from unstructured text
* [GitHub Actions](/guides/github-actions) — CI/CD automation with AI
* [Structured Outputs](/guides/structured-outputs) — reliable JSON responses
