SiliconFlow

获取batch任务列表

List your organization's batches.

GET
/batches
AuthorizationBearer <token>required

Use the following format for authentication: Bearer

In: header

Query Parameters

limitinteger

A limit on the number of objects to be returned.

Range1 <= value
afterstring

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

Response Body

fetch("https://api.siliconflow.cn/v1/batches?limit=1&after=string")
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "https://api.siliconflow.cn/v1/batches?limit=1&after=string"

  req, _ := http.NewRequest("GET", url, nil)
  
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.siliconflow.cn/v1/batches?limit=1&after=string"

response = requests.request("GET", url)

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;

HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://api.siliconflow.cn/v1/batches?limit=1&after=string"))
  .GET()
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var client = new HttpClient();
var response = await client.GetAsync("https://api.siliconflow.cn/v1/batches?limit=1&after=string");
var responseBody = await response.Content.ReadAsStringAsync();
curl --request GET \
  --url https://api.siliconflow.cn/v1/batches \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.siliconflow.cn/v1/batches"

headers = {"Authorization": "Bearer <token>"}

response = requests.request("GET", url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.siliconflow.cn/v1/batches', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));     
{
  "object": "list",
  "data": [
    {
      "id": "batch_id",
      "object": "batch",
      "endpoint": "/v1/chat/completions",
      "errors": null,
      "input_file_id": "file-id",
      "completion_window": "24h",
      "status": "in_queue",
      "output_file_id": null,
      "error_file_id": null,
      "created_at": 1749023566,
      "in_progress_at": null,
      "expires_at": 1749109966,
      "finalizing_at": null,
      "completed_at": null,
      "failed_at": null,
      "expired_at": null,
      "cancelling_at": null,
      "cancelled_at": null,
      "request_counts": null,
      "metadata": {
        "batch_description": "",
        "name": "batch"
      },
      "file_name": "requests_name.json"
    }
  ],
  "first_id": "first_batch_id",
  "last_id": "last_batch_id",
  "has_more": false
}
{
  "code": 20012,
  "message": "string",
  "data": "string"
}
"Invalid token"
"Forbidden"
"404 page not found"
{
  "code": 50505,
  "message": "Model service overloaded. Please try again later.",
  "data": "string"
}
"string"