Developer Docs
Reference docs for compatible endpoints, authentication, request format, streaming responses, and error handling.
Quick Start
Set the endpoint, configure your key, integrate the client, then send the first request.
Choose an endpoint
Pick the endpoint format your client expects. Chat Completions, Responses, and Messages-compatible routes are available.
Base URL: https://api.weeanno.example/v1Prepare your API key
Use an active API key from your server environment. Avoid exposing keys in browser-side code.
Authorization: Bearer sk-your-api-keyIntegrate your client
Use a compatible SDK or call the REST API directly with a custom base_url.
client = OpenAI(base_url='https://api.weeanno.example/v1')Start calling
Send requests and receive AI responses. Streaming is supported for a faster perceived response.
POST /v1/chat/completionsAuthentication
Every API request must include your API key in the HTTP Authorization header.
Authentication format
Add your API key to the Authorization header on every request.
/v1/chat/completionsAuthenticated request example
curl https://api.weeanno.example/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'{
"id": "chatcmpl_123",
"object": "chat.completion",
"choices": [{
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
}
}]
}https://api.weeanno.example/v1Use this for most clientshttps://api.weeanno.exampleUse only if your client rejects /v1 during validation/v1/chat/completionsFor clients that expect Chat Completions/v1/responsesUse first for clients that support Responses/v1/messagesUse first for Messages-compatible clientsChat Completions API
OpenAI-compatible Chat Completions endpoint for multiple model ecosystems.
from openai import OpenAI
# Initialize the client
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.weeanno.example/v1"
)
# Send a chat request
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Introduce yourself in one sentence."}
]
)
print(response.choices[0].message.content)Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID, for example gpt-4o-mini |
messages | array | Yes | Array of chat messages |
temperature | number | No | Sampling temperature from 0 to 2, default 1 |
max_tokens | integer | No | Maximum number of tokens to generate |
stream | boolean | No | Whether to enable streaming output |
top_p | number | No | Nucleus sampling value, default 1 |
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Unique response identifier |
object | string | Object type, usually chat.completion |
created | integer | Creation timestamp |
model | string | Model ID used for the response |
choices | array | Generated response choices |
usage | object | Token usage statistics |
Streaming
Enable streaming to receive generated tokens in real time and reduce perceived latency.
- Lower perceived latency - Users can see output immediately instead of waiting for the full response.
- Better long-form experience - Long answers appear progressively, similar to live typing.
- Same cost - Streaming uses the same pricing as synchronous output; only the transport changes.
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.weeanno.example/v1"
)
# Enable streaming
stream = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Introduce yourself in one sentence."}
],
stream=True
)
# Print each streamed token as it arrives
for chunk in stream:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
print() # New lineErrors
Common API errors and recommended handling steps.
| HTTP status | Error name | Description | Recommended action |
|---|---|---|---|
400 | INVALID_REQUEST | Request body is malformed or parameters are invalid | Check the request body and parameters |
401 | UNAUTHORIZED | API key is invalid or expired | Verify that the API key is correct |
429 | RATE_LIMIT | Request rate limit exceeded | Retry with exponential backoff |
500 | INTERNAL_ERROR | Internal service error | Try again later |
503 | SERVICE_UNAVAILABLE | Service temporarily unavailable | Try again later |
Rate Limits
API requests are rate limited to keep the service stable.
- Each API key has its own request-rate limits
- Use exponential backoff when you receive a 429 response
- Streaming and non-streaming requests share the same rate-limit quota
- The effective limit follows the current configuration of the key
