Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

old sk api keys can't be generated anymore #32

Description

@emboha

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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions