Cursor

Use TunAI models in Cursor's chat

Documentation

Use TunAI with Cursor

Cursor can send its chat to any OpenAI-compatible API. Point it at TunAI to use Claude, GPT, Gemini and the rest in Cursor's chat, billed to your TunAI balance in TND.

Good to know

  • Chat only. Tab completion always uses Cursor's own models.
  • Cursor relays the requests. They go through Cursor's servers, with your key, before reaching TunAI.
Pick one to fill in the samples, or see all supported models.

1Create a key for Cursor

Create a key on API keys and give it a monthly budget, so Cursor can never spend more than you planned. Make sure you have a balance.

2Connect Cursor to TunAI

  1. Open Cursor Settings → Models.
  2. Under OpenAI API Key, paste your TunAI key.
  3. Switch on Override OpenAI Base URL and enter:
https://api.tunai.tn/v1

3Add your model

In the model list, add a custom model and type its id exactly. Repeat for each model you want.

<model-id>

4Chat

Pick the model in the chat's model menu and send a message. Each request appears on the Logs page with its cost.

Troubleshooting

No base URL optionSome Cursor plans and builds don't show Override OpenAI Base URL. Update Cursor; if it's still missing, your plan doesn't offer custom endpoints.
Cursor's own models failWhile the override is on, Cursor sends requests for most models to TunAI, including its own. Turn the override off to use Cursor's models again.
401 invalid API keyPaste the full sk-tunai-... key again and make sure the override is switched on.
402 insufficient_quotaYour balance is empty or the key reached its monthly budget. Top up on Billing.
404 model_not_foundThe model name must be the exact TunAI id. Copy it from Supported models.