Skip to content

Retrieve file content

client.Files.Content(ctx, fileID) (*Response, error)
GET/files/{file_id}/content

Returns the contents of the specified file.

ParametersExpand Collapse
fileID string
ReturnsExpand Collapse
type FileContentResponse interface{…}

Retrieve file content

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Files.Content(context.TODO(), "file_id")
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
Returns Examples