Get started

Quickstart

Create a key, install an SDK and get your first article back in a few minutes.

This guide takes you from a new account to a streamed article. You need an SEOsorted account and either Python 3.8 or later, Node.js 18 or later, or a terminal with cURL.

  1. Create an API key

    Open the API keys page in the console and choose Create key. Copy the key when it appears: it is shown only once. Every new organization gets $5 of free credit, so you can start without adding a card.

  2. Set the key as an environment variable

    Keep the key out of your source code. The examples in these docs read it from SEOSORTED_API_KEY.

    export SEOSORTED_API_KEY="sk-sorted-..."
  3. Install an SDK

    Use the official OpenAI SDK for your language. No SEOsorted package is needed.

    pip install openai
  4. Send your first request

    Point the client at the SEOsorted base URL and send a brief as the user message.

    curl https://api.seosorted.ai/v1/chat/completions \
      -H "Authorization: Bearer $SEOSORTED_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "inkwell-1",
      "messages": [
        {
          "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"
        }
      ]
    }'

    A successful response contains the article in choices[0].message.content and token counts in usage.

  5. Stream the article

    Long articles take time to write. Set stream to get tokens as they are generated, and ask for usage in the final chunk.

    curl https://api.seosorted.ai/v1/chat/completions \
      --no-buffer \
      -H "Authorization: Bearer $SEOSORTED_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "inkwell-1",
      "stream": true,
      "stream_options": {
        "include_usage": true
      },
      "messages": [
        {
          "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"
        }
      ]
    }'

Next steps