API Reference

Documentation

sylphx.ai exposes an OpenAI-compatible API. If your code already uses the OpenAI SDK, you need to change exactly one line.

Overview

The sylphx.ai gateway serves the Lumen model family — four first-party, continuously-improving models — behind a single OpenAI-compatible API. We implement the OpenAI Chat Completions API, so any client library that targets OpenAI — in any language — works with sylphx.ai without modification beyond the base URL and key.

  • Full OpenAI Chat Completions API compatibility (/v1/chat/completions)
  • Server-sent events streaming
  • Multi-turn conversation support
  • System prompts, tool use, and vision inputs
  • Session-aware cache affinity for faster multi-turn conversations

Authentication

Pass your sylphx.ai API key in the Authorization header as a Bearer token. You can generate and manage API keys from your dashboard.

http headers
Authorization: Bearer YOUR_SYLPHX_API_KEY
Content-Type: application/json
Note: Never expose your API key client-side. Set it as a server-side environment variable (e.g. SYLPHX_API_KEY).

Base URL

url
https://api.sylphx.ai/v1

All endpoints are relative to this base URL. For example, the chat completions endpoint is POST https://api.sylphx.ai/v1/chat/completions.

Quick Start

Three steps to your first response:

  1. 1Get your API key from your dashboard.
  2. 2Point your OpenAI client at the sylphx.ai base URL, https://api.sylphx.ai/v1.
  3. 3Make your first request, naming a Lumen model id such as sylphx/lumen.

The example below uses sylphx/lumen, the default tier. Swap in any id from the Model IDs table.

typescript
import OpenAI from "openai"

const client = new OpenAI({
  apiKey: process.env.SYLPHX_API_KEY,
  baseURL: "https://api.sylphx.ai/v1",
})

async function main() {
  const response = await client.chat.completions.create({
    model: "sylphx/lumen",
    messages: [
      {
        role: "user",
        content: "Explain the difference between LLMs and diffusion models.",
      },
    ],
  })

  console.log(response.choices[0].message.content)
}

main()

Streaming

sylphx.ai supports server-sent events (SSE) streaming via the standard OpenAI SDK. Pass stream: true to receive chunks as they arrive.

typescript
import OpenAI from "openai"

const client = new OpenAI({
  apiKey: process.env.SYLPHX_API_KEY,
  baseURL: "https://api.sylphx.ai/v1",
})

const stream = await client.chat.completions.create({
  model: "sylphx/lumen-flash",
  messages: [
    { role: "user", content: "Write a recursive Fibonacci in TypeScript." }
  ],
  stream: true,
})

for await (const chunk of stream) {
  const content = chunk.choices[0]?.delta?.content
  if (content) {
    process.stdout.write(content)
  }
}

Resumability

Most streaming APIs give you no way to recover a dropped response — a network blip, a deploy, or a proxy timeout throws away the partial output and you start the request over from scratch. sylphx.ai journals every stream so you can pick up exactly where you left off, using standard SSE reconnection semantics rather than a bespoke protocol.

Every streaming response returns an x-sylphx-resume-token header. If the connection drops mid-stream, reissue the same request with two headers: that resume token, and a Last-Event-ID set to the id of the last event you successfully processed. You get back everything generated after that point — and if the original response hadn't finished, a clean signal telling you so, so you can retry without guessing.

http
# Every streaming response returns a resume token:
x-sylphx-resume-token: <token>

# If the connection drops, replay the SAME request with two headers —
# the resume token, plus the id of the last event you processed:
Authorization: Bearer YOUR_SYLPHX_API_KEY
x-sylphx-resume-token: <token>
Last-Event-ID: 42

Model IDs

The Lumen family is four tiers of one continuously-improving engine, each tuned to a different quality-and-cost curve. Pass the id as the model field in your request.

ModelModel IDBuilt for
Lumen Flashsylphx/lumen-flashInteractive apps, chat surfaces, high-volume light work
Lumensylphx/lumenEveryday agentic work
Lumen Prosylphx/lumen-proComplex agentic work, planning, hard reasoning
Lumen Ultrasylphx/lumen-ultraResearch, critique, the decisions that matter

Error Codes

sylphx.ai returns standard OpenAI-format error responses. HTTP status codes follow REST conventions.

StatusMeaning
401Invalid or missing API key
403Key does not have access to this model
404Model not found
429Rate limit exceeded — retry with backoff
502Temporary internal routing error — retried automatically
503The engine is temporarily unable to serve any lane — retry with backoff