API Documentation
Alaya Code provides OpenAI-compatible and Anthropic-compatible APIs for seamless integration with mainstream AI applications.
Authentication
All API requests require an API Key in the HTTP Header for authentication:
Authorization: Bearer sk-your-api-keyYou can create and manage API Keys in Console > Dashboard to view usage and manage API Keys.
API Endpoints
POST /v1/chat/completions
Create chat completions with streaming and non-streaming responses. This is the most commonly used endpoint.
Request Example
curl https://codingplan.alayanew.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxx" \
-d '{
"model": "minimax-m2.5",
"messages": [
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"}
],
"temperature": 0.7,
"stream": false
}'Response Example
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"created": 1234567890,
"model": "minimax-m2.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 15,
"total_tokens": 35
}
}Common Parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Model name, e.g. minimax-m2.5, glm-5 |
messages | array | List of conversation messages |
temperature | number | Temperature parameter, 0-2, default 1 |
stream | boolean | Enable streaming response, default false |
max_tokens | integer | Maximum number of tokens to generate |
POST /v1/embeddings
Create text vector embeddings.
GET /v1/models
List currently available models.
curl https://codingplan.alayanew.com/v1/models \
-H "Authorization: Bearer sk-xxx"POST /anthropic/v1/messages
Anthropic Messages API compatible endpoint. For tools using the Anthropic SDK like Claude Code.
curl https://codingplan.alayanew.com/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: sk-xxx" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "minimax-m2.5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello"}
]
}'Note: The Anthropic compatible API uses the x-api-key header instead of Authorization: Bearer.
Rate Limits
API requests are subject to rate limiting. Limits depend on your plan tier:
| Plan | RPM (Requests Per Minute) | TPM (Tokens Per Minute) |
|---|---|---|
| Lite | 10 | 60,000 |
| Pro | 60 | 600,000 |
| MAX 5X | 300 | 3,000,000 |
| MAX 20X | 1,200 | 12,000,000 |
Last updated on
Was this page helpful?
