Skip to content

Commit

Permalink
Merge pull request #15 from ronaldmannak/main
Browse files Browse the repository at this point in the history
Customize API BaseURL
  • Loading branch information
btfranklin authored Feb 19, 2024
2 parents 4939df7 + 4dfd0d1 commit f0ebfa1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Sources/CleverBird/OpenAIAPIConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@ public class OpenAIAPIConnection {

let apiKey: String
let organization: String?
let client: APIClient
public let client: APIClient
let requestHeaders: [String:String]

public init(apiKey: String, organization: String? = nil) {
public init(apiKey: String,
organization: String? = nil,
scheme: String = "https",
host: String = "api.openai.com",
port: Int = 443) {
self.apiKey = apiKey
self.organization = organization

var urlComponents = URLComponents()
urlComponents.scheme = "https"
urlComponents.host = "api.openai.com"
urlComponents.scheme = scheme
urlComponents.host = host
urlComponents.port = port
let openAIAPIURL = urlComponents.url

let clientConfiguration = APIClient.Configuration(baseURL: openAIAPIURL)
Expand Down

0 comments on commit f0ebfa1

Please sign in to comment.