Create Batch Job

Creates a batch job to process multiple requests asynchronously.

POST /v1/batch

Request Body

Les paramètres suivants peuvent être inclus dans le corps de la requête :

Paramètres

input_file_id
string
Required

The ID of an uploaded file that contains requests to be processed.

endpoint
string
Required

The endpoint to use for all requests in the batch.

completion_window
string
Default Value: 24h

The time frame within which the batch should be processed.

Successful Response

Les champs suivants sont retournés dans une réponse réussie :

Champs de réponse

id
string
Required

A unique identifier for the batch job.

object
string
Required

The object type, which is always "batch".

status
string
Required

The status of the batch job.

created_at
integer
Required

The Unix timestamp when the batch was created.

input_file_id
string
Required

The ID of the input file.

endpoint
string
Required

The endpoint used for the batch.

Examples

Exemples de code pour utiliser cet endpoint :

typescript
import { AlphaEdge } from '@alphaedge/alphaedge';

const alphaedge = new AlphaEdge({
  apiKey: process.env.ALPHAEDGE_API_KEY,
});

const batch = await alphaedge.batch.create({
  input_file_id: 'file-abc123',
  endpoint: '/v1/chat/completions',
  completion_window: '24h'
});
python
from alphaedge import AlphaEdge

alphaedge = AlphaEdge(api_key="your-api-key")

batch = alphaedge.batch.create(
    input_file_id="file-abc123",
    endpoint="/v1/chat/completions",
    completion_window="24h"
)
curl
curl https://api.alphaedge-ai.com/v1/batch \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ALPHAEDGE_API_KEY" \
  -d '{
    "input_file_id": "file-abc123",
    "endpoint": "/v1/chat/completions",
    "completion_window": "24h"
  }' 

Response

Exemple de réponse de l'API :

json
{
  "id": "batch-abc123",
  "object": "batch",
  "status": "validating",
  "created_at": 1234567890,
  "input_file_id": "file-abc123",
  "endpoint": "/v1/chat/completions"
}