Compatible endpoints · Auth · Streaming

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/v1

Prepare your API key

Use an active API key from your server environment. Avoid exposing keys in browser-side code.

Authorization: Bearer sk-your-api-key

Integrate 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/completions

Authentication

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.

POST/v1/chat/completions

Authenticated request example

Request example
json
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!"}]
  }'
Response example
json
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "choices": [{
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    }
  }]
}
Recommended Base URL
https://api.weeanno.example/v1Use this for most clients
Fallback Base URL
https://api.weeanno.exampleUse only if your client rejects /v1 during validation
Chat Completions-compatible endpoint
/v1/chat/completionsFor clients that expect Chat Completions
Responses-compatible endpoint
/v1/responsesUse first for clients that support Responses
Messages-compatible endpoint
/v1/messagesUse first for Messages-compatible clients

Chat Completions API

OpenAI-compatible Chat Completions endpoint for multiple model ecosystems.

python
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

ParameterTypeRequiredDescription
modelstringYesModel ID, for example gpt-4o-mini
messagesarrayYesArray of chat messages
temperaturenumberNoSampling temperature from 0 to 2, default 1
max_tokensintegerNoMaximum number of tokens to generate
streambooleanNoWhether to enable streaming output
top_pnumberNoNucleus sampling value, default 1

Response fields

FieldTypeDescription
idstringUnique response identifier
objectstringObject type, usually chat.completion
createdintegerCreation timestamp
modelstringModel ID used for the response
choicesarrayGenerated response choices
usageobjectToken usage statistics

Streaming

Enable streaming to receive generated tokens in real time and reduce perceived latency.

Benefits of streaming
  • 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.
python
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 line

Errors

Common API errors and recommended handling steps.

HTTP statusError nameDescriptionRecommended action
400INVALID_REQUESTRequest body is malformed or parameters are invalidCheck the request body and parameters
401UNAUTHORIZEDAPI key is invalid or expiredVerify that the API key is correct
429RATE_LIMITRequest rate limit exceededRetry with exponential backoff
500INTERNAL_ERRORInternal service errorTry again later
503SERVICE_UNAVAILABLEService temporarily unavailableTry again later

Rate Limits

API requests are rate limited to keep the service stable.

Rate-limit rules
  • 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

Questions? Contact support or read the FAQ.