Guide - Guides

How do I set up the AI assistant in Ruststudio with my own API key?

#ai#setup#assistantpublished 0 replies0 views
ReplyWatch
Share
Hacker NewsRedditLinkedInE-mail

Short answer

Open AI > AI Providers..., add a provider from the list, enter the API key (or env:NAME to read it from an environment variable), choose Test connection, then Save. Open the assistant panel with Ctrl+Shift+I. The assistant talks directly to the provider you chose with your own key.

Checked with Ruststudio source code (core/rs-core/src/ai.rs and core/rs-ui/src/ai_ui.rs); no Rust code was run for this thread

Guide written by the Ruststudio team. Replies are open: corrections are welcome.

#1

What you will build#

A working AI chat panel in the editor, connected to the model provider of your choice. Ruststudio does not supply a model or a key: you bring an account with a provider, and requests go from your computer to that provider.

Before you start#

  • An account with one of the providers below, or a local model server (see the thread on local models), and an API key from the provider's website.
  • The provider list in Ruststudio: Anthropic Claude, OpenAI, Google Gemini, Alibaba Qwen (international and China endpoints), DeepSeek, Mistral AI, Groq, xAI Grok, OpenRouter, Together AI, Moonshot Kimi, Zhipu GLM, and the local servers Ollama, LM Studio and llama.cpp. Three "Custom" entries cover any other service that speaks the OpenAI, Anthropic or Gemini request format.

Steps#

1. Open the providers dialog#

Choose AI > AI Providers.... When no provider exists yet, the dialog opens with the list of presets. Otherwise press + Add provider.

2. Pick a preset#

A preset fills in the API base URL and a suggested model name. Both stay editable, so you can choose another model the provider offers.

3. Enter the key#

The field is labelled API key (or env:VARIABLE). Either paste the key, or type env: followed by the name of an environment variable, for example env:ANTHROPIC_API_KEY; Ruststudio then reads the key from that variable each time and does not keep it. If the variable named by the preset already exists when you add the preset, Ruststudio fills in the env: form for you. Providers that run on your own machine (Ollama, LM Studio, llama.cpp) need no key.

4. Test, use and save#

  • Test connection sends the message "Reply with the single word: ok" and shows either "Connected" with the start of the reply, or the error the provider returned (a wrong key, an unknown model).
  • Use this one makes the provider the active one.
  • Save keeps the list.

5. Open the assistant#

Press Ctrl+Shift+I (or AI > Toggle AI Assistant). AI > New AI Chat starts a fresh conversation.

Check that it works#

Type a question and press Enter (Shift+Enter adds a line). The reply streams in as the provider produces it. If nothing happens, check the provider entry: Ruststudio reports a provider that cannot be used yet, for example "Enter an API key" or "The environment variable ... is not set".

Troubleshooting#

  • "The environment variable X is not set": the variable must exist in the environment of the process that started Ruststudio. Set it, then start Ruststudio again.
  • A reply never arrives: Ruststudio waits up to 15 seconds to connect and 120 seconds for data from the provider before it reports an error.
  • You want several providers: add each one and switch with Use this one.

Going further#

Read the threads on what the assistant sends, how to keep the key safe, and how to apply code from a reply.

Does Ruststudio include an AI model?#

No. The assistant is a client for the providers listed above. Which one you use, and what it costs, is between you and the provider.

    QuoteReply
    Share
    Hacker NewsRedditLinkedInE-mail

    No replies yet