This endpoint allows you to have a conversation with the model by sending a series of messages.
/v1/chat/completions
Request Body
Les paramètres suivants peuvent être inclus dans le corps de la requête :
Paramètres
model
alphaedge-large-3-2512
ID of the model to use.
messages
A list of messages comprising the conversation so far.
max_tokens
The maximum number of tokens to generate in the chat completion.
temperature
1.0
What sampling temperature to use, between 0 and 2.
stream
false
Whether to stream back partial progress.
Successful Response
Les champs suivants sont retournés dans une réponse réussie :
Champs de réponse
id
A unique identifier for the chat completion.
object
The object type, which is always "chat.completion".
model
The model used for the chat completion.
created
The Unix timestamp of when the completion was created.
choices
The list of completion choices.
usage
Usage statistics for the completion request.
Examples
Exemples de code pour utiliser cet endpoint :
import { AlphaEdge } from '@alphaedge/alphaedge';
const alphaedge = new AlphaEdge({
apiKey: process.env.ALPHAEDGE_API_KEY,
});
const completion = await alphaedge.chat.completions.create({
model: 'alphaedge-large-3-2512',
messages: [
{ role: 'user', content: 'Hello!' }
],
});
from alphaedge import AlphaEdge
alphaedge = AlphaEdge(api_key="your-api-key")
completion = alphaedge.chat.completions.create(
model="alphaedge-large-3-2512",
messages=[
{"role": "user", "content": "Hello!"}
]
)
curl https://api.alphaedge-ai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ALPHAEDGE_API_KEY" \
-d '{
"model": "alphaedge-large-3-2512",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
Response
Exemple de réponse de l'API :
{
"id": "chat-abc123",
"object": "chat.completion",
"model": "alphaedge-large-3-2512",
"created": 1234567890,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 5,
"completion_tokens": 10,
"total_tokens": 15
}
}