API Reference

Documentation

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

Overview

The sylphx.ai gateway proxies requests to upstream model providers (Anthropic, ZAI, and more). We implement the Anthropic Messages API, so any client library that targets Anthropic — in any language — works with sylphx.ai without modification beyond the base URL and key.

  • Full Anthropic Messages API compatibility (v1/messages)
  • Server-sent events streaming
  • Multi-turn conversation support
  • System prompts, tool use, and vision inputs
  • Provider-side prompt cache affinity

Base URL

url
https://api.sylphx.ai

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

Authentication

Pass your sylphx.ai API key in the x-api-key header. You can generate and manage API keys from your dashboard.

http headers
x-api-key: YOUR_SYLPHX_API_KEY
anthropic-version: 2023-06-01
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).

Quick Start

Install the Anthropic SDK and point it at the sylphx.ai gateway.

typescript
import Anthropic from "@anthropic-ai/sdk"

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

async function main() {
  const message = await client.messages.create({
    model: "anthropic/claude-sonnet-4-6",
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: "Explain the difference between LLMs and diffusion models.",
      },
    ],
  })

  console.log(message.content)
}

main()

Streaming

sylphx.ai supports server-sent events (SSE) streaming via the standard Anthropic SDK .stream() interface.

typescript
import Anthropic from "@anthropic-ai/sdk"

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

const stream = await client.messages.stream({
  model: "zai/glm-5.1",
  max_tokens: 2048,
  messages: [
    { role: "user", content: "Write a recursive Fibonacci in TypeScript." }
  ],
})

for await (const event of stream) {
  if (
    event.type === "content_block_delta" &&
    event.delta.type === "text_delta"
  ) {
    process.stdout.write(event.delta.text)
  }
}

Model IDs

Model identifiers follow the format provider/model-name. Pass these as the model field in your request.

ModelModel ID
Claude Opus 4.6anthropic/claude-opus-4-6
Claude Sonnet 4.6anthropic/claude-sonnet-4-6
GLM-5V-Turbozai/glm-5v-turbo
GLM-5.1zai/glm-5.1
GLM-5 Turbozai/glm-5-turbo
GLM-5zai/glm-5
GLM-4.7zai/glm-4.7

Error Codes

sylphx.ai returns standard Anthropic-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
502Upstream provider error — automatic failover triggered
503All upstream providers unavailable