Using the API

Batches

Send many requests at once and collect the results later.

Coming soon

Batch processing is not available yet. This page describes what is planned.

Batches will let you submit many briefs in one upload and collect the articles when they finish, at a lower price than individual requests. Until then, send requests in parallel within your rate limits.

Python
import asyncio, os
from openai import AsyncOpenAI

client = AsyncOpenAI(base_url="https://api.seosorted.ai/v1", api_key=os.environ["SEOSORTED_API_KEY"])
limit = asyncio.Semaphore(4)

async def write(brief: str) -> str:
    async with limit:
        r = await client.chat.completions.create(
            model="inkwell-1",
            messages=[{"role": "user", "content": brief}],
        )
        return r.choices[0].message.content

async def main(briefs: list[str]):
    return await asyncio.gather(*(write(b) for b in briefs))