godo.BatchInference.CreateJob()

Generated on 5 Nov 2026 from godo version v1.236.0

Usage

client.BatchInference.CreateJob(ctx context.Context, createReq *godo.CreateBatchRequest) (*godo.Batch, *godo.Response, error)

Description

CreateJob creates a new batch inference job.

This method sends a POST request to /v1/batches.

Parameters

createReq *godo.CreateBatchRequest required

Fields of godo.CreateBatchRequest

CreateBatchRequest represents a request to create a batch inference job. Provider is always required. Endpoint is required only when Provider is “openai”.

Provider string

JSON key: provider

FileID string

JSON key: file_id

CompletionWindow string

JSON key: completion_window

RequestID string

Omitted from JSON when empty. JSON key: request_id

Endpoint string

Omitted from JSON when empty. JSON key: endpoint

Returns

*godo.Batch
*godo.Response

The HTTP response, with pagination Links, Meta, and Rate limit information.

error

Non-nil when the request fails. API errors are returned as *godo.ErrorResponse.

Fields of godo.Batch

Batch represents a batch inference job returned by the inference proxy. Timestamps are ISO 8601 strings. Nullable fields use *string.

BatchID string

JSON key: batch_id

Provider string

JSON key: provider

FileID string

JSON key: file_id

CompletionWindow string

JSON key: completion_window

Status string

JSON key: status

RequestID string

JSON key: request_id

RequestCounts *godo.BatchRequestCounts

Omitted from JSON when empty. JSON key: request_counts

ResultAvailable bool

JSON key: result_available

CancelRequestedAt *string

JSON key: cancel_requested_at

CreatedAt string

JSON key: created_at

UpdatedAt string

JSON key: updated_at

ExpiresAt *string

JSON key: expires_at

Request Sample

Show Request Sample
package main

import (
	"context"
	"fmt"
	"log"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken(os.Getenv("DIGITALOCEAN_TOKEN"))
	ctx := context.TODO()

	result, _, err := client.BatchInference.CreateJob(ctx, &godo.CreateBatchRequest{
		Provider: "<your-provider>",
		FileID: "<your-file-id>",
		CompletionWindow: "<your-completion-window>",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%+v\n", result)
}

More Information

See POST /v1/batches in the API reference for additional detail on responses, headers, parameters, and more.

See the Go package documentation for the source of this method.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.