SilverMarcs / GPTalks

Multi-platform (iOS/iPadOS/visionOS/MacOS) ChatGPT API client written in SwiftUI
36 stars 8 forks source link

API Keys #18

Open moh1122 opened 6 days ago

moh1122 commented 6 days ago

Can I know where to add the API Keys. I found in Providor folder but its not working im still getting this error message: Error: APIErrorResponse(error: OpenAI.APIError(message: "You didn\'t provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you\'re accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.", type: "invalid_request_error", param: nil, code: nil))

SilverMarcs commented 6 days ago

Are you trying to hardcode the api key?

Ideally you should go into settings, go to Provider settings in there, select your provider (OpenAI) and put your API Key there

moh1122 commented 6 days ago

yup how can I hardcode it. I checked it in settings and its awesome

SilverMarcs commented 6 days ago

Glad to hear it works now.

If you really want to hardcode, perhaps check GPTalks > LLM > Provider.swift and replace the apiKey field with your api key. But this will take effect only for new providers you add since the existing ones were already created with an empty API Key. But really, you should not consider this option since every provider needs its own API Keys