API Documentation
Quick integration guide and complete API reference
Quickstart
Go live in 3 minutes
If this is your first time here, you do not need to understand every technical term first. Create an account, generate an API key, and copy the example request below to verify your integration.
The current API supports the OpenAI Chat Completions-compatible format, so you can integrate with the OpenAI SDK or compatible clients directly. OpenAI Responses-compatible and Anthropic Messages-compatible formats will be added later.
We recommend starting with the text endpoint. It is the simplest path and the fastest way to confirm your setup works.
https://api.weiapi.ai/v1Create account and token
Create a token in the console. Tokens start with sk-.
Create an account and sign in to the console first. Once logged in, you can open the token page and generate your own API key.
Fetch model catalog
Call /v1/models first to discover the live callable models.
Copy and save the API key right after creation. If the token is scoped, you can only call the models that token is allowed to access.
Call the unified endpoint
Use the matching /v1 endpoint for text, image, video, or audio.
Start by sending a single chat request to confirm the integration works, then continue with image, video, or other advanced workflows.
Send your first text request
Best place to startIf you only want to confirm that your account, API key, and base URL are configured correctly, test with this minimal example first.
curl https://api.weiapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_MODEL_ID",
"messages": [
{"role": "user", "content": "你好,请介绍一下你自己"}
],
"stream": false
}'What should success look like?
If the response contains model-generated content, your integration is live. If you get a 401, check the API key. If you get a 404, verify the model ID.
What to do next
Explore text capabilities
Open the full text / multimodal reference for request structure, examples, and response shape.
No code yet? Use Playground first
Choose a token and model in the console, then send a request directly to confirm the account, permissions, and model work.
Try image generation
Once text works, continue with the image generation endpoint for the next validation step.
Learn the video task flow
Video generation is async, so it is best tested after your basic integration is already working.
