Christian Hahn
Christian Hahn

Reputation: 21

OpenAI API: How do I set the organization ID?

I'm trying to create a support bot.

When I try to use OpenAI I always get the following error:

Rate limit reached for text-embedding-ada-002 in organization org-xxxxxxxxxxxxxxxxxxxxx on requests per min (RPM): Limit 3, Used 3, Requested 1.

I think this is because I didn't set my organization ID from the paid Team subscription, where the rate limit shouldn't be reached.

How can I set the organization ID?

Upvotes: 2

Views: 2301

Answers (1)

Rok Benko
Rok Benko

Reputation: 23060

As stated in the official OpenAI documentation:

Users who belong to multiple organizations can pass a header to specify which organization is used for an API request. Usage from these API requests will count against the specified organization's quota. If no header is provided, the default organization will be billed. You can change your default organization in your user settings.

Python

from openai import OpenAI

client = OpenAI(
  organization = 'org-xxxxxxxxxxxxxxxxxxxxxxx',
)

Node.js

import OpenAI from "openai";

const openai = new OpenAI({
  organization: 'org-xxxxxxxxxxxxxxxxxxxxxxx',
});

cURL

curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "OpenAI-Organization: org-xxxxxxxxxxxxxxxxxxxxxxx"

Upvotes: 2

Related Questions