Compatible Gateways

Ollama Cloud

Use hosted Ollama models with Anvia.

Ollama Cloud exposes hosted models through Ollama's cloud API. Treat it as a separate configuration from local Ollama because authentication, model availability, and base URLs differ.

Create the Client

import { AgentBuilder } from "@anvia/core";
import { OpenAIClient } from "@anvia/openai";

const client = new OpenAIClient({
  baseUrl: "https://ollama.com/v1",
  apiKey: process.env.OLLAMA_API_KEY,
});

const model = client.completionModel("gpt-oss:20b");

const agent = new AgentBuilder("cloud-support", model)
  .instructions("Answer support questions clearly.")
  .build();

const response = await agent.prompt("Hello!").send();

console.log(response.output);

Get the Model List

If your Ollama Cloud account exposes the OpenAI-compatible models endpoint, use listModels().

const models = await client.listModels();

console.table(models.data.map((model) => ({ id: model.id, owner: model.ownedBy })));

Notes

  • Keep local Ollama and Ollama Cloud as separate app configuration entries.
  • Model ids and availability can differ from your local Ollama runtime.

For current Ollama Cloud details, see Ollama Cloud.