Skip to content

vravind1/terraform-provider-openai

Repository files navigation

Terraform Provider: OpenAI

The Terraform Provider for OpenAI is a plugin built using the Terraform Plugin Framework.

Requirements

Usage

NOTE: To use the OpenAI provider, set your OpenAI API key as the OPENAI_APIKEY environment variable.

terraform {
required_providers {
    openai = {
      source  = "registry.terraform.io/vravind1/openai"    
      version = "0.1.0".  // use the appropriate version
    }
  }
}

data "openai_completion" "example" {
  model      = "text-davinci-003"
  max_tokens = 16
  prompt     = "which is the best cloud provider?"
}

output "example_response" {
  value = data.openai_completion.example.result
}

output "example_tokens" {
  value = data.openai_completion.example.total_tokens
}

output "example_reason" {
  value = data.openai_completion.example.finish_reason
}

More details on how to use this provider can be found on the Terraform Registry.

License

MIT License

About

Terraform Provider for Open AI APIs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages