Quick Start

LLM API Quick Start

Use this LLM API quick start when you want to test WaveSpeedAI LLM quickly and make your first OpenAI-compatible Chat Completions request.

Option 1: Try It in the Playground

The fastest way to understand the service is through the web UI.

  1. Open wavespeed.ai/llm.
  2. Pick a model from the model selector.
  3. Send a short prompt.
  4. Adjust temperature, max tokens, or streaming if needed.
  5. Open View Code to copy an API example for the current model and settings.

The Playground is also the recommended place to confirm the latest model IDs, context windows, and prices.

Option 2: Call the OpenAI-Compatible API

WaveSpeedAI LLM uses the OpenAI Chat Completions format.

FieldValue
Base URLhttps://llm.wavespeed.ai/v1
Chat endpointhttps://llm.wavespeed.ai/v1/chat/completions
API keyYour WaveSpeedAI API key
ProtocolOpenAI-compatible Chat Completions
Rate limitVaries by account and model; read the response headers

Minimal cURL Request for the LLM API

curl --fail-with-body --connect-timeout 10 --max-time 120 \
  https://llm.wavespeed.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
  -d '{
    "model": "deepseek/deepseek-v4-flash",
    "messages": [
      {
        "role": "user",
        "content": "Write a concise product description for WaveSpeedAI LLM."
      }
    ]
  }'

Python OpenAI SDK Example

import os
from openai import OpenAI
 
client = OpenAI(
    api_key=os.environ["WAVESPEED_API_KEY"],
    base_url="https://llm.wavespeed.ai/v1",
    timeout=120.0,
    max_retries=2,
)
 
try:
    response = client.chat.completions.create(
        model="deepseek/deepseek-v4-flash",
        messages=[
            {"role": "user", "content": "Give me three ways to reduce LLM cost."}
        ],
    )
except Exception as exc:
    raise SystemExit(f"LLM request failed: {exc}") from exc
 
print(response.choices[0].message.content)

JavaScript OpenAI SDK Example

import OpenAI from "openai";
 
const client = new OpenAI({
  apiKey: process.env.WAVESPEED_API_KEY,
  baseURL: "https://llm.wavespeed.ai/v1",
  timeout: 120_000,
  maxRetries: 2,
});
 
if (!process.env.WAVESPEED_API_KEY) throw new Error("Set WAVESPEED_API_KEY");
 
try {
  const response = await client.chat.completions.create({
    model: "deepseek/deepseek-v4-flash",
    messages: [
      { role: "user", content: "Summarize what an OpenAI-compatible API means." }
    ],
  });
 
  console.log(response.choices[0]?.message?.content ?? "");
} catch (error) {
  console.error("LLM request failed:", error);
  process.exitCode = 1;
}

What to Change Next

ChangeField
Try another modelmodel
Make output shorter or longermax_tokens
Make output more focusedLower temperature
Make output more creativeRaise temperature
Stream output as it is generatedstream: true
Improve repeated long promptsKeep a stable prefix and see Prompt Caching

For production traffic, read the X-RateLimit-* response headers, handle 429 responses, and retry transient failures with bounded exponential backoff and jitter. Limits can vary by account and model. If you need a higher limit, contact support@wavespeed.ai with the target models, expected request volume, peak RPM, and business or usage details for review.

Common Request Fields

Support for optional generation fields can vary by model. Start with model and messages, then add optional fields after testing the selected model.

FieldRequiredDescription
modelYesModel ID, such as deepseek/deepseek-v4-flash
messagesYesConversation messages in OpenAI chat format
streamNoReturn incremental chunks
max_tokensNoLimit output length
temperatureNoControl randomness
top_pNoNucleus sampling

Messages can include system, user, and assistant roles. Send previous turns again when you want the model to keep context.

Streaming Example

Use streaming when you want to show text as soon as it is generated.

import OpenAI from "openai";
 
const client = new OpenAI({
  apiKey: process.env.WAVESPEED_API_KEY,
  baseURL: "https://llm.wavespeed.ai/v1",
  timeout: 120_000,
  maxRetries: 2,
});
 
const stream = await client.chat.completions.create({
  model: "deepseek/deepseek-v4-flash",
  messages: [
    { role: "user", content: "Write a short onboarding checklist." }
  ],
  stream: true,
});
 
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || "");
}

Next Steps

© 2026 WaveSpeedAI. All rights reserved.