openai-java
openai-java copied to clipboard
How to set organisation id
I have multiple organizations setup and I need to specify which one is used. Is there a way to do it? https://platform.openai.com/docs/api-reference/requesting-organization
Have you found the solution yet? I was looking for this too, but could not find yet
I think the best you can do right now is to add the header to the ExecutorService by using this version of the constructor:
public OpenAiService(final OpenAiApi api, final ExecutorService executorService) {
this.api = api;
this.executorService = executorService;
}
And then I'm not exactly sure where to put this, but you can initialize and add headers where the HTTP request is constructed.
HashMap <String, String> headers = new HashMap<>();
headers.put("organization", "YOUR_ORG_ID");
There is an open PR for this - #69. @TheoKanning can you merge it?