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
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.
x-api-key: YOUR_SYLPHX_API_KEY anthropic-version: 2023-06-01 Content-Type: application/json
SYLPHX_API_KEY).Quick Start
Install the Anthropic SDK and point it at the sylphx.ai gateway.
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.
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.
| Model | Model ID |
|---|---|
| Claude Opus 4.6 | anthropic/claude-opus-4-6 |
| Claude Sonnet 4.6 | anthropic/claude-sonnet-4-6 |
| GLM-5V-Turbo | zai/glm-5v-turbo |
| GLM-5.1 | zai/glm-5.1 |
| GLM-5 Turbo | zai/glm-5-turbo |
| GLM-5 | zai/glm-5 |
| GLM-4.7 | zai/glm-4.7 |
Error Codes
sylphx.ai returns standard Anthropic-format error responses. HTTP status codes follow REST conventions.
| Status | Meaning |
|---|---|
| 401 | Invalid or missing API key |
| 403 | Key does not have access to this model |
| 404 | Model not found |
| 429 | Rate limit exceeded — retry with backoff |
| 502 | Upstream provider error — automatic failover triggered |
| 503 | All upstream providers unavailable |