belweave infer uses the OpenAI Chat Completions format. Existing code needs two changes: the base URL and the key.
Get a key
Email info@belweave.com with your name and a short description of your software or engineering work. We verify your identity before issuing a key. Limits are arranged per access when your key is issued.
For immediate use or interest, email info@belweave.com.
Base URL and auth
Authentication
Base URL: https://api.infer.belweave.ai/v1
Header: Authorization: Bearer $BELWEAVE_API_KEY
Keep the key in an environment variable, not in source control.
First request
example/v1/chat/completions
cURL
curl https://api.infer.belweave.ai/v1/chat/completions \
-H "Authorization: Bearer $BELWEAVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
"messages": [
{"role": "system", "content": "You are a software engineering assistant."},
{"role": "user", "content": "Explain how to make an API request safe to retry."}
]
}'Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.infer.belweave.ai/v1",
api_key=os.environ["BELWEAVE_API_KEY"],
)
resp = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4.1-Flash-1017",
messages=[
{"role": "system", "content": "You are a software engineering assistant."},
{"role": "user", "content": "Explain how to make an API request safe to retry."},
],
)
print(resp.choices[0].message.content)JavaScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.infer.belweave.ai/v1",
apiKey: process.env.BELWEAVE_API_KEY,
});
const resp = await client.chat.completions.create({
model: "deepseek-ai/DeepSeek-V4.1-Flash-1017",
messages: [{ role: "user", content: "Write a test for retrying a failed API request." }],
});
console.log(resp.choices[0].message.content);Streaming
Set stream: true to receive tokens as server-sent events (SSE).
example/v1/chat/completions
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.infer.belweave.ai/v1",
api_key=os.environ["BELWEAVE_API_KEY"],
)
stream = client.chat.completions.create(
stream=True,
model="deepseek-ai/DeepSeek-V4.1-Flash-1017",
messages=[
{"role": "system", "content": "You are a software engineering assistant."},
{"role": "user", "content": "Explain how to make an API request safe to retry."},
],
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Supported features
| Feature | Use |
|---|---|
| Chat completions | Send messages to POST /v1/chat/completions |
| Streaming | Set stream: true for server-sent events |
| Tool calling | Get tool calls for your application to handle |
| Reasoning output | Receive reasoning alongside the answer |
Errors
| Code | Meaning | What to do |
|---|---|---|
| 401 | Missing or invalid key | Check the Authorization header |
| 403 | Key suspended | Email info@belweave.com |
| 429 | Rate limited | Back off and retry. Limits are arranged when your key is issued. |
| 503 | Service temporarily unavailable | Check Status and retry |
Retries
Retry temporary errors with backoff and make long jobs resumable. Check Status for service information.
