Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[custom endpoint] Add support for getting auth token from command line #107

Open
sa- opened this issue Nov 8, 2024 · 5 comments
Open

[custom endpoint] Add support for getting auth token from command line #107

sa- opened this issue Nov 8, 2024 · 5 comments
Assignees
Labels
feature request The issue is a feature request

Comments

@sa-
Copy link

sa- commented Nov 8, 2024

At our company we have an OpenAI API compatible model router deployed which can only be accessed via short lived tokens.

This means we can't put a long-lived API key in the configuration since long-lived tokens cannot be generated.

We would be able to use this if we provide a custom bash command to get an auth token like get-auth-token --name vs-code-ai

@swatDong
Copy link
Contributor

It's able to use environment variable when adding a model to "My Model" list.

E.g., for Open AI models,

  • Create environment variable OPENAI_API_KEY on your machine

  • (Close and reopen VSCode instances to ensure the env var works in VSC)

  • When adding Open AI model, you'll see an option "Use $OPENAI_API_KEY"
    Image

  • After adding model like this, AI Toolkit will call the model by referencing the value from your env var.

BTW, Antropic model uses ANTHROPIC_API_KEY, Google model uses GEMINI_API_KEY

(Let me also add these steps to the doc)

@sa-
Copy link
Author

sa- commented Nov 20, 2024

That's good to know! Although it doesn't quite solve the issue as we would have to quit and reopen VS code every few hours from the command line like

OPENAI_API_KEY=$(get-auth-token) code

It's just inconvenient enough that people would be discouraged from using this

@drewmacphee
Copy link

We too have moved to oauth only for aoai access, specifically Az cli Entra ID. It would be nice if that were supported.
Thanks.

@sa- sa- changed the title [custom endpoint] Add support for getting auth token from command [custom endpoint] Add support for getting auth token from command line Nov 20, 2024
@swatDong
Copy link
Contributor

Thanks all for the detailed scenarios. Added to our backlog.
FYI @sffamily

@swatDong swatDong added the feature request The issue is a feature request label Nov 21, 2024
@sffamily
Copy link
Contributor

@sa- Your use case is a valid scenario that we've added to our feature backlog and will investigate and plan it for our next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request The issue is a feature request
Projects
None yet
Development

No branches or pull requests

4 participants