Using the API

Chat completions

Send a brief as a user message and get an article back, using the OpenAI chat format.

POST /v1/chat/completions is the main endpoint and the one the OpenAI SDKs call by default. It accepts the OpenAI Chat Completions request format and returns a chat.completion object.

Messages

Inkwell turns a brief into an article, so the roles mean something slightly different from a chat model.

RoleHow Inkwell uses it
userThe brief. At least one user message is required. Several user messages are joined in order.
systemExtra instructions for this article. developer is accepted as an alias.
assistantIgnored. Send each article as a fresh request.
curl https://api.seosorted.ai/v1/chat/completions \
  -H "Authorization: Bearer $SEOSORTED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "inkwell-1",
  "temperature": 0.8,
  "max_tokens": 1200,
  "messages": [
    {
      "role": "system",
      "content": "Use British spelling."
    },
    {
      "role": "user",
      "content": "Topic: Why most home espresso tastes sour\nAudience: people who just bought their first espresso machine\nKey points: grind finer in small steps; weigh the dose; aim for 25 to 30 seconds\nLength: about 600 words"
    }
  ]
}'

Response

200 OK
{
  "id": "chatcmpl-5f0c2b9e7a1d4e8f9c3b6a20",
  "object": "chat.completion",
  "created": 1764230400,
  "model": "inkwell-1",
  "system_fingerprint": null,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Your new machine is not broken. If your first shots taste sharp and thin...",
        "refusal": null
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 74,
    "completion_tokens": 812,
    "total_tokens": 886
  }
}

finish_reason is stop when the article ended naturally and length when it hit max_tokens. If you see length, raise the limit.

Sampling parameters

ParameterDefaultNotes
temperature0.80 to 2. Lower is more predictable, higher is more varied. 0.6 to 0.9 works well for articles.
top_p0.95Nucleus sampling. Change temperature or top_p, not both.
max_tokens1600Upper limit on output length. max_completion_tokens is accepted as an alias.
stopnoneA string or list of strings that end the article early.
seednoneSet for more repeatable output across identical requests.

See the API reference for every field.