Skip to main content
Sail exposes an OpenAI-compatible Responses API. If you’re already using the OpenAI SDK, switching to Sail is a one-line change.

1. Get your API key

Sign up at the Sail dashboard and create an API key.

2. Make your first request

Install the OpenAI SDK and point it at the Sail API. Create a response with background=True so the request returns immediately, then poll until it completes:
import time
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_SAIL_API_KEY",
    base_url="https://api.sailresearch.com/v1",
)

creation = client.responses.create(
    model="sail-default",
    input="Explain the key ideas behind transformer architectures.",
    background=True,
)

while True:
    response = client.responses.retrieve(creation.id)
    if response.status == "completed":
        print(response.output_text)
        break
    if response.status == "failed":
        raise RuntimeError("Response failed")
    time.sleep(1)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_SAIL_API_KEY",
  baseURL: "https://api.sailresearch.com/v1",
});

const creation = await client.responses.create({
  model: "sail-default",
  input: "Explain the key ideas behind transformer architectures.",
  background: true,
});

while (true) {
  const response = await client.responses.retrieve(creation.id);
  if (response.status === "completed") {
    console.log(response.output_text);
    break;
  }
  if (response.status === "failed") {
    throw new Error("Response failed");
  }
  await new Promise((r) => setTimeout(r, 1000));
}
# Create the response (returns immediately with an id)
RESPONSE_ID=$(curl -s https://api.sailresearch.com/v1/responses \
  -H "Authorization: Bearer YOUR_SAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sail-default",
    "input": "Explain the key ideas behind transformer architectures.",
    "background": true
  }' | jq -r '.id')

# Poll until completed
until [ "$(curl -s https://api.sailresearch.com/v1/responses/$RESPONSE_ID \
  -H "Authorization: Bearer YOUR_SAIL_API_KEY" | jq -r '.status')" = "completed" ]; do
  sleep 1
done

curl -s https://api.sailresearch.com/v1/responses/$RESPONSE_ID \
  -H "Authorization: Bearer YOUR_SAIL_API_KEY" | jq -r '.output_text'

3. Next steps