API Documentation
Quick integration guide and complete API reference
Text / Multimodal API
/v1/chat/completionsThe best endpoint to test first
Both text and multimodal requests use this endpoint. Whether you are building chat, writing, text generation, or image-based understanding, this is usually the right place to start.
/v1/chat/completions follows the OpenAI Chat Completions-compatible request / response shape, including core fields such as model, messages, and stream. OpenAI Responses and Anthropic Messages compatibility will be supported in later versions.
For a first integration, begin with the simplest text-only request. After that works, continue with image input, longer context, or streaming output.
POST /v1/chat/completions
Chat, writing, Q&A, text generation, multimodal understanding
Send one simple text message first
When you should start with this endpoint
Use this endpoint first for chat, writing, translation, summarization, Q&A, or general text generation.
If the model accepts image input, the content still goes through messages, but may include image objects or other multimodal content parts.
This is usually the easiest endpoint to validate, making it the best place to confirm your API key, base URL, and model ID are correct.
CURL example
CURLcurl https://api.weiapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "user", "content": "Hello"}
],
"stream": false
}'Python SDK example
pythonfrom openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.weiapi.ai/v1",
)
response = client.chat.completions.create(
model="YOUR_MODEL_ID",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)Node.js SDK example
typescriptimport OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-api-key",
baseURL: "https://api.weiapi.ai/v1",
});
const response = await client.chat.completions.create({
model: "YOUR_MODEL_ID",
messages: [{ role: "user", content: "Hello" }],
});
console.log(response.choices[0]?.message?.content);Things to keep in mind
- The model field must contain a real callable model ID from this platform, not just a vendor name or a broad capability label.
- Plain text requests are the easiest to debug. After that works, continue with image input or streaming features.
- If the response contains model-generated content, your base integration is working. If you get a 401 or 404, check the API key and model ID first.
