Skip to content

Commit

Permalink
ref: update provider docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jianyuan committed May 26, 2024
1 parent 97dcb09 commit 25638c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
page_title: "openai Provider"
subcategory: ""
description: |-
The OpenAI provider allows you to configure resources and data sources for your OpenAI organization. It uses internal APIs, so breaking changes are expected.
Unfortunately, OpenAI's API keys do not allow some functionalities. Therefore, we need to obtain an OpenAI session key from the Authorization header of any requests to https://api.openai.com/dashboard/*. Log in to https://platform.openai.com, use Inspect Element to look for any requests to https://api.openai.com/dashboard/*, and grab the Authorization header value.
---

# openai Provider

The OpenAI provider allows you to configure resources and data sources for your OpenAI organization. It uses internal APIs, so breaking changes are expected.

Unfortunately, OpenAI's API keys do not allow some functionalities. Therefore, we need to obtain an OpenAI session key from the `Authorization` header of any requests to `https://api.openai.com/dashboard/*`. Log in to https://platform.openai.com, use Inspect Element to look for any requests to `https://api.openai.com/dashboard/*`, and grab the `Authorization` header value.

## Example Usage

```terraform
provider "openai" {
# example configuration here
session_key = "sess-0000000000000000000000000000000000000000"
}
```

Expand All @@ -24,4 +27,4 @@ provider "openai" {
### Optional

- `base_url` (String) Base URL for the OpenAI API. Defaults to `https://api.openai.com`.
- `session_key` (String, Sensitive) Session key for the OpenAI API.
- `session_key` (String, Sensitive) The OpenAI session key can be obtained by accessing the dashboard in your browser. This can also be set via the `OPENAI_SESSION_KEY` environment variable. Note that the session key must start with `sess-`.
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
provider "openai" {
# example configuration here
session_key = "sess-0000000000000000000000000000000000000000"
}
4 changes: 3 additions & 1 deletion internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ func (p *OpenAIProvider) Metadata(ctx context.Context, req provider.MetadataRequ

func (p *OpenAIProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: "The OpenAI provider allows you to configure resources and data sources for your OpenAI organization. It uses internal APIs, so breaking changes are expected.\n\n" +
"Unfortunately, OpenAI's API keys do not allow some functionalities. Therefore, we need to obtain an OpenAI session key from the `Authorization` header of any requests to `https://api.openai.com/dashboard/*`. Log in to https://platform.openai.com, use Inspect Element to look for any requests to `https://api.openai.com/dashboard/*`, and grab the `Authorization` header value.",
Attributes: map[string]schema.Attribute{
"base_url": schema.StringAttribute{
MarkdownDescription: "Base URL for the OpenAI API. Defaults to `https://api.openai.com`.",
Optional: true,
},
"session_key": schema.StringAttribute{
MarkdownDescription: "Session key for the OpenAI API.",
MarkdownDescription: "The OpenAI session key can be obtained by accessing the dashboard in your browser. This can also be set via the `OPENAI_SESSION_KEY` environment variable. Note that the session key must start with `sess-`.",
Optional: true,
Sensitive: true,
},
Expand Down

0 comments on commit 25638c6

Please sign in to comment.