Skip to content

Undefined openai.ResponseNewParams in openai-go sdk #607

@devnchill

Description

@devnchill

I am trying to use openai-go SDK . i tried running simple example mentioned in docs https://developers.openai.com/api/docs/quickstart?language=golang#install-the-openai-sdk-and-run-an-api-call and it didn't run .

cmd/aicli/main.go:36:59: undefined: openai.ResponseNewParams
  • my code
package main

import (
	"context"
	"fmt"

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

func main() {
	client := openai.NewClient(
		option.WithAPIKey("OPENAI_API_KEY"),
	)

	resp, err := client.Responses.New(context.TODO(), openai.ResponseNewParams{
		Model: "gpt-5.2",
		Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("Say this is a test")},
	})
	if err != nil {
		panic(err.Error())
	}

	fmt.Println(resp.OutputText())
}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions