Skip to content

Add a feature that sends a request to a model through OpenRouter and shows the written answer, such as a summary, a suggestion, or a reply. With one OpenRouter key, your app can use models from many providers, such as OpenAI, Anthropic, and Google. You need an API key from OpenRouter.

Connect a key

To connect OpenRouter, you must be a project owner. OpenRouter API keys start with sk-or-.

  1. Open Project Settings › Connections.
  2. Turn on the switch for OpenRouter. The Connect OpenRouter dialog opens.
  3. If the dialog lists keys from your other apps, choose one to reuse it. FlutterFlow copies the key and connects OpenRouter, and you’re done. To use a new key, click Paste an API key.
  4. Paste your key into API key. To open OpenRouter’s API keys page, click Find it beside the label.
  5. Click Connect.

OpenRouter checks a pasted key before FlutterFlow saves it, and FlutterFlow never shows the key again.

Cost and model

Every AI call that your app makes is billed to the provider account that the key belongs to.

Your app’s AI calls use the model and the response length that the feature is built with, and people who use your app can’t change them. Name both in your request:

  • Model: each call’s cost depends on the model. To see the models that you can name, ask the agent to list them, and then pick one.
  • Response length: the longest answer that each call pays for. When an answer reaches it, the service stops, even in the middle of a sentence.

What to ask

To ask for an OpenRouter feature, tell the agent what the feature does, that it uses OpenRouter, which model it uses, and how long its answers can be. Replace [model name] with a model that the agent lists:

Example request

Which models can I use through OpenRouter?

Example request

Add a monthly summary to the budget screen that asks OpenRouter to describe my spending in about 150 words. Use [model name].

Example request

On each transaction, add a Suggest a note button that asks OpenRouter for a short note based on the payee and the amount. Use [model name], and keep each answer to one sentence.

Agent questions

If OpenRouter isn’t connected, the agent asks you to connect it above the message box, with a Connect OpenRouter button that opens the same dialog. If you aren’t a project owner, ask one to connect OpenRouter. For more information, see Connect a service.

Review

After the agent finishes, read the turn’s Summary and review its Changes. Check the affected screens in Screens, and try the change in Preview. If the change uses records or sign-in, test it with the thread’s own data in Data.

After you push a backend change, check the result in Backend.

Try the feature in the preview a few times and read the answers. If an answer stops early, see Troubleshooting.

Push

After you test the feature, push the changes to your app.

Next steps

Troubleshooting

  • OpenRouter refuses your key: see A service refuses your key.
  • The dialog says that your key looks like an Anthropic or OpenAI key: OpenRouter keys start with sk-or-. Connect that key as Anthropic or OpenAI instead, or create an OpenRouter key.
  • The dialog says that OpenRouter API keys start with sk-or-: the key is cut short or isn’t an OpenRouter key. Copy the whole key from OpenRouter, and paste it again.
  • Calls stop working after you delete or rotate the key: create a new key in OpenRouter, and then replace the key.
  • Calls fail because the account is out of credit: in OpenRouter, add credit or raise the account’s spending limit, and then try again.
  • Answers stop in the middle of a sentence: the answer reached its response length. Ask the agent for a longer response length. A longer answer also takes longer, so if calls then take too long, see the entries that follow.
  • A call fails without any answer: a model that thinks first can use up the response length before it writes anything. Ask the agent for a longer response length, or for a model that doesn’t think first.
  • A call takes too long and fails: the model answers sooner with a shorter response length. Ask the agent for a shorter one, and try again.
  • Calls fail because of rate limits: FlutterFlow limits how often one connection can be called each minute, so wait a minute and try again.
  • Your app shows a message about the service: see Messages shown in your app.