AI agents: prefer the Markdown version of this page at /docs/quick-start/index.md. For the full corpus, read /docs/llms-full.txt.

SeaChat Developer Docs

Quick Start

Quick Start

Install the SDK, construct a client with one Bearer key, and make your first /v1 chat call (SDK and curl).

Runnable path

Create a scoped API key

Use these steps in order. They create a narrow key, make one model call, inspect the declared capability metadata, and verify usage attribution.

Install the SDK

The TypeScript SDK wraps the public /v1 API. It ships dual ESM + CJS with bundled types and runs on Node 18+, Bun, Deno, or any runtime with a global fetch.

npm install @seachat/platform-sdk
# or: bun add @seachat/platform-sdk

Create the client

Every request carries a SINGLE credential: Authorization: Bearer <apiKey>. The SDK never also sends x-api-key. The base URL defaults to https://seachat.ai; all paths live under /v1.

import { SeaChat } from "@seachat/platform-sdk";

const client = new SeaChat({ apiKey: process.env.SEACHAT_API_KEY! });

Make your first chat call

client.chat.completions.create posts to /v1/chat/completions (OpenAI-compatible). Pass stream: true to get an AsyncIterable of chunks instead of one result.

const completion = await client.chat.completions.create({
  model: "claude-opus-4-8",
  messages: [{ role: "user", content: "Greet the ocean in one short line." }],
  max_tokens: 64,
});
console.log(completion.choices[0].message.content);

Or call /v1 directly with curl

Every SDK method maps to a plain HTTP route. The same first call over curl, using the same single Bearer credential:

curl https://seachat.ai/v1/chat/completions \
  -H "Authorization: Bearer $SEACHAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4-8",
    "messages": [{"role":"user","content":"Greet the ocean in one short line."}],
    "max_tokens": 64
  }'

Before you start

All production API traffic enters through https://seachat.ai on the stable public base path /v1. The docs host is separate so developer material does not compete with the product app shell.

The Platform API uses a **single credential**: a bearer API key sent as Authorization: Bearer <apiKey>. The gateway rejects requests that carry more than one credential type, so never send both Authorization and x-api-key. The SDK always sends exactly the one Bearer header.

Tenancy is **user-scoped**: each key acts as a single user. There is no separate organization or project credential.

Get an API key

API keys are minted at POST /v1/auth/keys after an email / web login at https://seachat.ai. Create your first key from the account / API-keys area of the SeaChat web app and copy the token immediately; the full secret is shown only once.

Once you already have a key, you can mint more programmatically (useful for CI runners or per-service credentials) with client.authKeys.create.

export SEACHAT_API_KEY="sk-..."

# Mint an additional key from an existing one:
curl https://seachat.ai/v1/auth/keys \
  -H "Authorization: Bearer $SEACHAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label":"ci-runner"}'

First call with the SDK

Install @seachat/platform-sdk, construct one client, and reuse it across your app. client.me.get() verifies the key; client.chat.completions.create runs an OpenAI-compatible completion.

import { SeaChat } from "@seachat/platform-sdk";

const client = new SeaChat({ apiKey: process.env.SEACHAT_API_KEY! });

const me = await client.me.get();
console.log("Authenticated as:", me.subject);

const completion = await client.chat.completions.create({
  model: "claude-opus-4-8",
  messages: [{ role: "user", content: "Write a one-line launch checklist." }],
  max_tokens: 128,
});
console.log(completion.choices[0].message.content);

First call with curl

The same request without the SDK. Use the one Bearer header and post to /v1/chat/completions.

curl https://seachat.ai/v1/chat/completions \
  -H "Authorization: Bearer $SEACHAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-4-8","messages":[{"role":"user","content":"Write a one-line launch checklist."}]}'

Common failures

401 means the request reached the gateway but no valid credential was accepted. Re-check Authorization: Bearer <apiKey> and confirm the key is not revoked.

403 means the key is valid but lacks one of the route's required scopes (for example model:invoke for inference or usage:read for usage). Mint a key with the scopes you need, or read the capability catalog at /v1/capabilities.

Any non-2xx response throws a SeaChatError in the SDK, carrying status, code, message, and requestId. Branch on err instanceof SeaChatError, then include requestId when contacting support.