Skip to main content
Secrets never leak

Run AI agents safely with Ollama and Fly.io

Developers sandboxing coding agents often face a tough choice: give them model access or keep credentials out of reach. Fly.io's new Ollama integration tries to solve that dilemma, and the way it does so is worth a closer look.
Run AI agents safely with Ollama and Fly.io
Run AI agents safely with Ollama and Fly.io

Ollama Cloud now works inside full Linux computers built for agents. Through a new Ollama Connector, code running in Fly.io Sprites can call Ollama's cloud models, including kimi-k3, glm-5.3 and deepseek-v4.1-flash, without the agent ever seeing your API key.

A Sprite is a sandbox from Fly.io. Each one is a full Linux virtual machine with its own disk that stays around between sessions. Claude Code, Codex and Gemini CLI are supported out of the box, letting agents run in a sandbox to securely run commands.

How the key stays protected

You add your Ollama API key to your Fly.io organization. Fly.io encrypts it and never returns it through the API. When code inside a Sprite calls Ollama, the request goes through a Fly.io gateway. The gateway checks which Sprite is calling and adds your key to the request. The Sprite itself only knows a gateway URL and a connection ID, so an agent in a Sprite can't leak your key.

Access is restricted by default. New connectors block every Sprite until you choose which ones get access, by label, by name prefix or all of them. Calls only work from inside a Sprite.

Setup and usage

You need an Ollama API key and at least one Sprite. In the Fly.io dashboard, open Sprites, then Connectors, and add an Ollama connector with your API key. Under Access Configuration, choose which Sprites can use it and save. Click Test reachability next to a Sprite to confirm it can reach Ollama.

From inside the Sprite, you can test with:

curl "https://api.sprites.dev/v1/gateway/ollama//v1/chat/completions"  -H "Content-Type: application/json"  -d '{"model": "kimi-k3", "messages": [{"role": "user", "content": "Hello!"}]}'

The connector page shows this command with your connection ID filled in. No Authorization header is needed because the gateway adds your key.

Any OpenAI SDK works. Set base_url to the gateway and use any value for api_key. Ollama's native /api/* routes also work through the gateway.

Sprites also come with a skill that tells Claude Code, Cursor, Codex and Gemini CLI about Ollama. If a Sprite has access, its agent can use Ollama models without any setup.

Fly.io's fuzzing guide shows the models working together. A small model, nemotron-3-nano:30b, writes malformed inputs, a Sprite runs them against your program, and a larger model, kimi-k3, analyzes the crashes. To switch models, change the model field. The article points to the Ollama Connector quickstart at sprites.dev.

Key Features at a Glance

  • Encrypted key storage: Fly.io encrypts your Ollama API key and never returns it through the API, so agents inside a Sprite can't read or leak it.
  • Gateway key injection: Requests pass through a Fly.io gateway that adds your key; the Sprite only knows a gateway URL and a connection ID.
  • Default-deny access: New connectors block all Sprites until you grant access by label, name prefix or all Sprites.
  • Sprite-only calls: Calls only work from inside a Sprite, which limits where the connection can be used.
  • Model choice: kimi-k3, glm-5.3 and deepseek-v4.1-flash are named examples; changing the model field switches models.
  • Agent support: Claude Code, Codex and Gemini CLI work out of the box, and the Sprite skill covers Cursor too, so agents need no extra setup.
  • OpenAI SDK compatibility: Point base_url at the gateway; native /api/* routes also work.

Availability

The announcement is dated October 13, 2026. The Ollama Connector is configured in the Fly.io dashboard under Sprites and Connectors. It requires an Ollama API key and at least one Sprite. The article does not state pricing.

Felipe Santos

“Artificial intelligence can process the world in milliseconds, but only the human heart can give meaning to every second lived” – Mr. Santos