Connect Ollama apps to Datagram

Apps and code written for Ollama can use our models with no local GPU: point them at our Ollama address and add your key.

Works with Datagram AI

All guides · API quickstart · Last checked: ollama-python 0.6.3, November 2026

  1. 1. Create an accountSign up in a minute and get $5 of free credit. Already a customer? Sign in.
  2. 2. Make an API keyIn your account, open AI API and press Create key. Keys start with dgk_. Keep yours secret.
  3. 3. Follow the steps belowCopy each block, paste your key where it says dgk_your_key_here.

Your Ollama address

Ollama URL / host
https://api.datagram.net/v1/ollama
API key
your dgk_ key, sent as Authorization: Bearer dgk_…
Models
the same names as in Ollama, for example gemma4:12b or qwen3-coder:30b

In an app's settings, put the address where it asks for the Ollama URL (instead of http://localhost:11434), and your key where it asks for an API key or custom header. The app must be able to send the key; apps that only connect to a local Ollama with no key can't use it.

Try it with curl

export DATAGRAM_API_KEY="dgk_your_key_here"

# Models your key can use
curl https://api.datagram.net/v1/ollama/api/tags -H "Authorization: Bearer $DATAGRAM_API_KEY"

# Chat (streams by default, like Ollama)
curl https://api.datagram.net/v1/ollama/api/chat -H "Authorization: Bearer $DATAGRAM_API_KEY" \
  -d '{"model": "gemma4:12b", "messages": [{"role": "user", "content": "Say hello"}], "stream": false}'

Python (ollama library)

pip install ollama. The library sends OLLAMA_API_KEY as your key, so existing Ollama code only needs a new host:

export OLLAMA_API_KEY="dgk_your_key_here"
from ollama import Client

client = Client(host="https://api.datagram.net/v1/ollama")

reply = client.chat(model="gemma4:12b", messages=[{"role": "user", "content": "Write a haiku about servers."}])
print(reply.message.content)

for part in client.chat(model="gemma4:12b", messages=[{"role": "user", "content": "Count to five."}], stream=True):
    print(part.message.content, end="", flush=True)

JavaScript (ollama library)

npm install ollama

import { Ollama } from "ollama";

const ollama = new Ollama({
  host: "https://api.datagram.net/v1/ollama",
  headers: { Authorization: `Bearer ${process.env.DATAGRAM_API_KEY}` },
});

const reply = await ollama.chat({ model: "gemma4:12b", messages: [{ role: "user", content: "Say hello" }] });
console.log(reply.message.content);

What works

Ollama endpoint
/api/chat, /api/generateYes, streamed or not, with tools and images on models that support them
/api/embed, /api/embeddingsYes
/api/tags, /api/show, /api/versionYes
/api/pull, push, create, copy, deleteNo. We manage the models for you

Billing is the same as our OpenAI-compatible API: each model's token price, from your credit. Rate limits and model limits on your key apply here too.

If something goes wrong

401 "Missing API key"

The app isn't sending your key. Look for an "API key", "Bearer token" or "custom headers" setting. If the app has none, it can't connect to a hosted Ollama server; use its OpenAI-compatible option with our base URL instead, if it has one.

"is not enabled for this key"

Your key is limited to certain models. Change that in your account under AI API, or use a model from /api/tags.

The ollama command says "something went wrong"

The ollama command only sends keys to ollama.com, so it can't sign in to us. Use an app or library instead.

Questions

Do I need Ollama installed?

No. Our servers run the models. Your app or code only needs to be able to talk to an Ollama server and send an API key.

Can I use the ollama command (ollama run, ollama list)?

Not at the moment. The ollama command only sends API keys to ollama.com, so our server can't tell who you are. Use an app or library that lets you set an API key or headers, or use our OpenAI-compatible API.

Can I download (pull) or add my own models?

No. We manage the models, so pull, push, create, copy and delete are switched off. You can use every model in the list at no setup cost. Want a model we don't have? Ask us, or run your own on a dedicated Mac.

Are the model names the same as in Ollama?

Yes, for example gemma4:12b or qwen3-coder:30b. GET /api/tags lists the ones your key can use.

Is it private?

Yes. Requests run on our own Macs and we never store prompts or answers, only counts for billing.

Create an account Get an API key More guides →