Alaya NeW Cloud

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-key

You 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

ParameterTypeDescription
modelstringModel name, e.g. minimax-m2.5, glm-5
messagesarrayList of conversation messages
temperaturenumberTemperature parameter, 0-2, default 1
streambooleanEnable streaming response, default false
max_tokensintegerMaximum 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:

PlanRPM (Requests Per Minute)TPM (Tokens Per Minute)
Lite1060,000
Pro60600,000
MAX 5X3003,000,000
MAX 20X1,20012,000,000

Last updated on

Was this page helpful?

On this page