Skip to content

Hosted APIs

Hosted APIs give you large models without hardware. twinny treats them as providers like any other; the difference is that your code is sent to the vendor, and you pay per token. Keys are stored with the provider in VS Code’s storage and are redacted from twinny’s logs.

Chat with a hosted API goes through the vendor’s SDK to its fixed endpoint, so the hostname, port and path fields are hidden. Completion and embeddings, where offered, are plain HTTP requests to the vendor’s route.

What each one can do

ProviderChatAutocomplete (FIM)EmbeddingsGet a key
OpenAI/v1/embeddingsplatform.openai.com
Anthropicconsole.anthropic.com
Mistral✓ Codestral /v1/fim/completionsconsole.mistral.ai
DeepSeek/beta/completionsplatform.deepseek.com
OpenRouter/api/v1/completionsopenrouter.ai
Geminiaistudio.google.com
Groqconsole.groq.com
Coheredashboard.cohere.com
Perplexityperplexity.ai/settings/api

Anthropic, Groq, Cohere, Perplexity and Gemini are chat-only: they have no completions endpoint twinny can drive with a fill-in-the-middle prompt. The form will not let you create an autocomplete provider for them.

Presets

Add providerHosted APIs lists each with a default model name you can change:

ProviderDefault chat modelNotes
OpenAIgpt-4.1Embeddings preset uses text-embedding-3-small
Anthropicclaude-sonnet-4-20250514
DeepSeekdeepseek-chatCompletion uses the same key with /beta/completions; deepseek-coder models work for FIM
Geminigemini-2.5-pro-preview-05-06
Groqllama-3.3-70b-versatileVery fast; good for chat with open models
Mistralmistral-small-latestThe Codestral preset (codestral-latest) is the recommended hosted autocomplete model
OpenRouteropenai/gpt-4.1One key for hundreds of models; names are vendor/model
Coherecommand-r-plus
Perplexityllama-3.1-sonar-small-128k-onlineAnswers can include web search results

Model names change as vendors release new ones; use whatever the vendor’s documentation lists. twinny does not validate hosted model names until a request is made, and a wrong name comes back as a model not found error.

Codestral for completion

Mistral’s Codestral is trained for fill-in-the-middle and served at a dedicated FIM endpoint, which makes it the one hosted option twinny recommends for autocomplete:

  1. Add provider → Autocomplete → Codestral.
  2. Paste a Mistral API key. Codestral may need its own key from the Codestral section of the Mistral console, depending on your plan.
  3. The FIM template is preset to codestral.

Latency is network-bound, so expect suggestions to arrive a little later than from a local model.

Mixing local and hosted

A common setup: a local 1.5B model for completion (fast, private, free, good enough for the next few lines) and a hosted model for chat, review and edits. Each job’s active provider is independent, so this needs no switching.

Privacy and cost

  • Everything in a request goes to the vendor: the prompt, the attached files, @workspace results, review diffs. Do not use a hosted provider for code you may not share.
  • Completion sends a request on every pause in typing. With a hosted autocomplete provider that adds up; watch the vendor’s usage page or set twinny.debounceWait higher.
  • twinny sends nothing to any vendor other than the ones you configure, and nothing at all to twinny’s authors.