Your first AIWave API call in 5 minutes
Run one small request before building around an API route. This guide creates a key, calls deepseek-v4-flash, and checks the request record in Console.
AIWave uses the OpenAI-compatible base URL https://aiwave.live/v1. Existing clients usually need a new base URL and key. Copy the model ID exactly.
1. Create an API key
Open AIWave Console, go to API Keys, choose Create key, and copy it once. Keep it server side, never in a browser bundle, screenshot, ticket, or repository.
export AIWAVE_API_KEY="sk-your-api-key"
test -n "$AIWAVE_API_KEY" && echo "key is set"
Validation: confirms the variable exists without displaying the key.
On PowerShell:
$env:AIWAVE_API_KEY = "sk-your-api-key"
if ($env:AIWAVE_API_KEY) { "key is set" }
Validation: the PowerShell equivalent. Replace the placeholder locally.
2. Run the smallest useful request
The live quickstart uses deepseek-v4-flash and a short arithmetic prompt, making the response easy to check.
curl https://aiwave.live/v1/chat/completions \
-H "Authorization: Bearer $AIWAVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"What is 2+2? Reply with just the number."}]}'
Validation: endpoint, path, headers, and model ID were copied from the live AIWave quickstart on 2026-09-23. Run it with your own key. Expect HTTP 200 and 4.
deepseek-v4-flash is a reasoning model, so the response may also contain a reasoning_content field. The answer you want is in choices[0].message.content.
3. Use the same route from Python
For an OpenAI Python client, change the endpoint configuration.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AIWAVE_API_KEY"],
base_url="https://aiwave.live/v1",
)
response = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "user", "content": "What is 2+2? Reply with just the number."}
],
)
print(response.choices[0].message.content)
Validation: matches the live quickstart. Run with openai installed and the variable set; expect 4.
4. Use the same route from Node.js
The OpenAI JavaScript client uses the same pattern.
npm install openai
Validation: installs the client only; it sends no request.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AIWAVE_API_KEY,
baseURL: "https://aiwave.live/v1",
});
const response = await client.chat.completions.create({
model: "deepseek-v4-flash",
messages: [
{ role: "user", content: "What is 2+2? Reply with just the number." },
],
});
console.log(response.choices[0].message.content);
Validation: matches the live quickstart. Run with Node.js and the variable set; expect 4.
Copy-ready smoke-test files
These files add status and error checks while keeping the request visible.
Bash
#!/usr/bin/env bash
set -Eeuo pipefail
: "${AIWAVE_API_KEY:?Set AIWAVE_API_KEY before running this file}"
endpoint="https://aiwave.live/v1/chat/completions"
payload='{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"What is 2+2? Reply with just the number."}]}'
body_file="$(mktemp)"
trap 'rm -f "$body_file"' EXIT
status="$(curl --silent --show-error --output "$body_file" --write-out '%{http_code}' \
"$endpoint" \
-H "Authorization: Bearer $AIWAVE_API_KEY" \
-H 'Content-Type: application/json' \
--data "$payload")"
echo "HTTP $status"
if [ "$status" != "200" ]; then
cat "$body_file"
exit 1
fi
cat "$body_file"
Validation: checks status and body without printing the key. Run with a controlled key.
Python
import json
import os
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
api_key = os.environ.get("AIWAVE_API_KEY")
if not api_key:
raise SystemExit("Set AIWAVE_API_KEY before running this file")
request = Request(
"https://aiwave.live/v1/chat/completions",
data=json.dumps({
"model": "deepseek-v4-flash",
"messages": [{
"role": "user",
"content": "What is 2+2? Reply with just the number.",
}],
}).encode("utf-8"),
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
},
method="POST",
)
try:
with urlopen(request, timeout=30) as response:
data = json.load(response)
print(json.dumps(data, indent=2))
except HTTPError as error:
print(f"HTTP {error.code}", file=sys.stderr)
print(error.read().decode("utf-8", errors="replace"), file=sys.stderr)
raise SystemExit(1)
except URLError as error:
raise SystemExit(f"Network error: {error.reason}")
Validation: Python 3 standard HTTP client; compare status and content with curl.
Node.js
import OpenAI from "openai";
const apiKey = process.env.AIWAVE_API_KEY;
if (!apiKey) {
throw new Error("Set AIWAVE_API_KEY before running this file");
}
const client = new OpenAI({
apiKey,
baseURL: "https://aiwave.live/v1",
});
try {
const response = await client.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{
role: "user",
content: "What is 2+2? Reply with just the number.",
}],
});
const message = response.choices?.[0]?.message?.content;
if (!message) throw new Error("The response did not contain assistant content");
console.log(message);
} catch (error) {
console.error("The first request failed. Check the HTTP error and request ID.");
throw error;
}
Validation: install openai, run as an ES module, and expect 4; the key is not printed.
5. Check the result before scaling up
After success, inspect the request record in Console: model ID, usage, effective rate, group, and status. Check the dated pricing page before budgeting. Connectivity is not workload fit; compare models with the same measured task.
If the request fails
-
400: check JSON,
model,messages, and content type. - 401: check the key and Authorization header without printing the key.
- 402: check balance and billing state in Console.
- 404: copy the exact current model ID from Models. Do not invent an alias.
-
429: honor
Retry-Afterwhen present and use bounded backoff. - 5xx: save the request ID, retry once, and check Status.
See Request recovery and the SSE guide.
What to do next
Keep the base URL and model in configuration. Check Pricing before a larger workload, then use the same request shape in the agent guide.
Self-check
- [x] Base URL and model ID copied from the live quickstart on 2026-09-23.
- [x] Examples use
sk-your-api-keyonly as a placeholder. - [x] Each code block has a validation note.
- [x] No credentials, customer data, internal metrics, or balance amount.
- [x] Internal links target live sign-in, docs, models, pricing, and status pages.
- [ ] Run a live request with a controlled test key before publishing.
- [ ] Run
curl -Ichecks for every internal link immediately before publication. - [ ] Run the final banned-word scan and word-count/code-ratio check.


Top comments (0)