Skip to content

Commit

Permalink
feat(integrations): add support for OpenAi (NangoHQ#2755)
Browse files Browse the repository at this point in the history
## Describe your changes

- Add support for OpenAi

## Issue ticket number and link

[EXT-158](https://linear.app/nango/issue/EXT-158/add-support-for-openapi-api-key)

---------

Co-authored-by: Samuel Bodin <[email protected]>
  • Loading branch information
hassan254-prog and bodinsamuel authored Sep 24, 2024
1 parent 0f8920c commit a4fb2d4
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docs-v2/integrations/all/openai.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: OpenAI
sidebarTitle: OpenAI
---

API configuration: [`openai`](https://nango.dev/providers.yaml)

## Features

| Features | Status |
| - | - |
| [Auth (API Key)](/integrate/guides/authorize-an-api) ||
| [Sync data](/integrate/guides/sync-data-from-an-api) ||
| [Perform workflows](/integrate/guides/perform-workflows-with-an-api) ||
| [Proxy requests](/integrate/guides/proxy-requests-to-an-api) ||
| [Receive webhooks](/integrate/guides/receive-webhooks-from-an-api) | 🚫 (time to contribute: &lt;48h) |

<Tip>We can implement missing features in &lt;48h, just ask for it in the [community](https://nango.dev/slack).</Tip>

## Getting started

- [Generate an API key in your OpenAI account](https://platform.openai.com/api-keys)
- [OpenAI API docs](https://platform.openai.com/docs/api-reference/introduction)
- [OpenAI Authentication](https://platform.openai.com/docs/api-reference/authentication)
- [OpenAI rate limits](https://platform.openai.com/docs/guides/rate-limits)

<Tip>Need help getting started? Get help in the [community](https://nango.dev/slack).</Tip>

## API gotchas

- OpenAI uses API_KEY auth mode with `Authorization: Bearer API_KEY` in the request header to access different endpoints.
- Nango supports automatic retries based on the `x-ratelimit-reset-requests` header from OpenAI's API. This header indicates when the request limit will reset, allowing Nango to efficiently manage API calls. Unlike `x-ratelimit-reset-tokens`, which pertains to the total token usage,`x-ratelimit-reset-requests` specifically addresses the number of API requests.
- For users associated with multiple organizations or accessing their projects via a legacy user API key, optional headers can be included to specify the organization and project for the API request. Organization IDs can be found on your [Organization settings](https://platform.openai.com/account/organization) page, while project IDs can be found on your [General settings](https://platform.openai.com/settings) page.
- This can be done at the script level:
```js
const config:ProxyConfiguration = {
endpoint: '/v1/models',
headers: {
'OpenAI-Organization': $organizationId,
'OpenAI-Project': $projectId
}
};
```

<Note>Add Getting Started links and Gotchas by [editing this page](https://github.com/nangohq/nango/tree/master/docs-v2/integrations/all/openai.mdx)</Note>
1 change: 1 addition & 0 deletions docs-v2/integrations/dev-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sidebarTitle: Developer Tools
<Card title="Google Play" href="/integrations/all/google-play" color="#68a063" />
<Card title="Klipfolio" href="/integrations/all/klipfolio" color="#68a063" />
<Card title="Mailgun" href="/integrations/all/mailgun" color="#68a063" />
<Card title="OpenAI" href="/integrations/all/openai" color="#68a063" />
<Card title="PagerDuty" href="/integrations/all/pagerduty" color="#68a063" />
<Card title="Pendo" href="/integrations/all/pendo" color="#68a063" />
<Card title="Posthog" href="/integrations/all/posthog" color="#68a063" />
Expand Down
1 change: 1 addition & 0 deletions docs-v2/integrations/productivity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ sidebarTitle: Productivity
<Card title="Mural" href="/integrations/all/mural" color="#68a063" />
<Card title="Notion" href="/integrations/all/notion" color="#68a063" />
<Card title="OneNote" href="/integrations/all/one-note" color="#68a063" />
<Card title="OpenAI" href="/integrations/all/openai" color="#68a063" />
<Card title="Pingboard" href="/integrations/all/pingboard" color="#68a063" />
<Card title="Pivotaltracker" href="/integrations/all/pivotaltracker" color="#68a063" />
<Card title="Productboard" href="/integrations/all/productboard" color="#68a063" />
Expand Down
1 change: 1 addition & 0 deletions docs-v2/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@
"integrations/all/okta",
"integrations/all/one-drive",
"integrations/all/one-note",
"integrations/all/openai",
"integrations/all/ory",
"integrations/all/osu",
"integrations/all/outlook",
Expand Down
16 changes: 16 additions & 0 deletions packages/shared/providers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2228,6 +2228,22 @@ one-note:
- productivity
alias: microsoft
docs: https://docs.nango.dev/integrations/all/one-note
openai:
categories:
- productivity
- dev-tools
auth_mode: API_KEY
proxy:
base_url: https://api.openai.com
headers:
Authorization: Bearer ${apiKey}
Content-Type: application/json
verification:
method: GET
endpoint: /v1/models
retry:
after: 'x-ratelimit-reset-requests'
docs: https://docs.nango.dev/integrations/all/openai
ory:
categories:
- other
Expand Down
1 change: 1 addition & 0 deletions packages/webapp/public/images/template-logos/openai.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a4fb2d4

Please sign in to comment.