Describe the problem
Since April 2024, new OpenAI accounts receive project secret keys that start with sk-proj-.
When I enter such a key in WristAssist 3.2.5 the app always returns: invalid_api_key
Current source (network/src/main/java/net/devemperor/wristassist/repository/NetworkRepository.kt) only sets the Authorization header, so the backend rejects the request.
Proposed fix
Add the missing header for project keys, e.g.:
val request = original.newBuilder()
.header("Authorization", "Bearer $apiKey")
.apply {
if (apiKey.startsWith("sk-proj-")) {
header("OpenAI-Project", projectId) // projectId can be stored next to the key in prefs
}
}
.build()
Describe the problem
Since April 2024, new OpenAI accounts receive project secret keys that start with
sk-proj-.When I enter such a key in WristAssist 3.2.5 the app always returns: invalid_api_key
Current source (
network/src/main/java/net/devemperor/wristassist/repository/NetworkRepository.kt) only sets theAuthorizationheader, so the backend rejects the request.Proposed fix
Add the missing header for project keys, e.g.: