Docs

Prerequisites

1

Create API Key

ActionLog in to the ComputeFlux DApp and go to /dashboard/api-keys to create an API Key
2

Confirm Provider Endpoint

Base URLhttps://test-api.computeflux.ai/v1
3

Confirm Model Name Format

Model<provider>/<model>, e.g. my-provider/gpt-4o

1. OpenAI SDK Setup

ComputeFlux provides an OpenAI-compatible /v1/chat/completions endpoint that works directly with the official OpenAI SDK.

from openai import OpenAI

client = OpenAI(
    base_url="https://test-api.computeflux.ai/v1",
    api_key="<your-computeflux-api-key>",
)

response = client.chat.completions.create(
    model="my-provider/gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello, ComputeFlux!"},
    ],
)

print(response.choices[0].message.content)

2. Popular AI Frameworks

2.1 LangChain

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://test-api.computeflux.ai/v1",
    api_key="<your-computeflux-api-key>",
    model="my-provider/gpt-4o",
)

response = llm.invoke("Hello, ComputeFlux!")
print(response.content)

2.2 LlamaIndex

from llama_index.llms.openai import OpenAI

llm = OpenAI(
    api_base="https://test-api.computeflux.ai/v1",
    api_key="<your-computeflux-api-key>",
    model="my-provider/gpt-4o",
)

response = llm.complete("Hello, ComputeFlux!")
print(response.text)

2.3 Vercel AI SDK

import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

const result = await generateText({
  model: openai("my-provider/gpt-4o", {
    baseURL: "https://test-api.computeflux.ai/v1",
    apiKey: "<your-computeflux-api-key>",
  }),
  prompt: "Hello, ComputeFlux!",
});

console.log(result.text);

2.4 PydanticAI

from pydantic_ai import Agent

agent = Agent(
    "openai:my-provider/gpt-4o",
    base_url="https://test-api.computeflux.ai/v1",
    api_key="<your-computeflux-api-key>",
)

result = agent.run_sync("Hello, ComputeFlux!")
print(result.data)

2.5 Mastra

import { Mastra } from "@mastra/core";
import { openai } from "@ai-sdk/openai";

const mastra = new Mastra({
  agents: {
    computeflux: {
      instructions: "You are a helpful assistant.",
      model: openai("my-provider/gpt-4o", {
        baseURL: "https://test-api.computeflux.ai/v1",
        apiKey: "<your-computeflux-api-key>",
      }),
    },
  },
});

const agent = mastra.getAgent("computeflux");
const result = await agent.generate("Hello, ComputeFlux!");
console.log(result.text);

2.6 TanStack AI

import { useChat } from "@tanstack/react-ai";

function Chat() {
  const { messages, input, handleInputChange, handleSubmit } = useChat({
    api: "https://test-api.computeflux.ai/v1/chat/completions",
    headers: { Authorization: `Bearer <your-computeflux-api-key>` },
    body: { model: "my-provider/gpt-4o" },
  });

  return (
    <form onSubmit={handleSubmit}>
      <input value={input} onChange={handleInputChange} />
      {messages.map((m) => (
        <div key={m.id}>{m.content}</div>
      ))}
    </form>
  );
}

2.7 Effect AI SDK

import { OpenAiClient } from "@effect/ai-openai";
import { Config, Effect, Layer, ConfigProvider } from "effect";

const ConfigLive = Layer.setConfigProvider(
  ConfigProvider.fromMap(
    new Map([
      ["OPENAI_API_KEY", "<your-computeflux-api-key>"],
      ["OPENAI_BASE_URL", "https://test-api.computeflux.ai/v1"],
    ])
  )
);

const program = Effect.gen(function* () {
  const client = yield* OpenAiClient;
  const response = yield* client.chat.completions({
    model: "my-provider/gpt-4o",
    messages: [{ role: "user", content: "Hello, ComputeFlux!" }],
  });
  return response.choices[0].message.content;
}).pipe(Effect.provide(ConfigLive));

Effect.runPromise(program).then(console.log);

3. Editors & Coding Assistants

3.1 Cursor

1

Add Custom Model

Open Cursor Settings → Models → Add model.
2

Fill in Model Name

Modelmy-provider/gpt-4o
3

Override Base URL

Base URLhttps://test-api.computeflux.ai/v1
4

Fill in API Key

API KeyYour ComputeFlux API Key
5

Save and Use

Save to use this model in Cursor Chat / Composer.

3.2 VSCode Copilot / Codex

export OPENAI_BASE_URL="https://test-api.computeflux.ai/v1"
export OPENAI_API_KEY="<your-computeflux-api-key>"

codex --model "my-provider/gpt-4o"

Or write to ~/.codex/config.yaml:

model: my-provider/gpt-4o
provider: openai
baseURL: https://test-api.computeflux.ai/v1
apiKey: <your-computeflux-api-key>

3.3 Cline

1

Open Cline Extension Settings

Click the Cline icon in VSCode's left sidebar to open the Settings panel.
2

Select Provider

ProviderOpenAI Compatible
3

Fill in Base URL

Base URLhttps://test-api.computeflux.ai/v1
4

Fill in API Key

API KeyYour ComputeFlux API Key
5

Fill in Model ID

Model IDmy-provider/gpt-4o

3.4 Roo Code

1

Open Roo Code Settings

Go to Roo Code Settings → API Provider.
2

Select Provider

ProviderOpenAI Compatible
3

Fill in Base URL

Base URLhttps://test-api.computeflux.ai/v1
4

Fill in API Key

API KeyYour ComputeFlux API Key
5

Fill in Model

Modelmy-provider/gpt-4o

3.5 Kilo Code

1

Open Kilo Code Settings

Open the Kilo Code settings panel.
2

Select Provider

ProviderOpenAI Compatible or Custom
3

Fill in Base URL

Base URLhttps://test-api.computeflux.ai/v1
4

Fill in Model

Modelmy-provider/gpt-4o

3.6 Aider

aider --model openai/my-provider/gpt-4o \
      --openai-api-base https://test-api.computeflux.ai/v1 \
      --openai-api-key <your-computeflux-api-key>

3.7 Deep Agents CLI

export OPENAI_BASE_URL="https://test-api.computeflux.ai/v1"
export OPENAI_API_KEY="<your-computeflux-api-key>"

deep-agents --model "my-provider/gpt-4o"

3.8 JetBrains Junie CLI

1

Open Junie Settings

Go to Settings → Tools → Junie.
2

Select Provider

ProviderOpenAI
3

Custom Base URL

Base URLhttps://test-api.computeflux.ai/v1
4

Fill in API Key

API KeyYour ComputeFlux API Key
5

Fill in Model

Modelmy-provider/gpt-4o

3.9 Xcode

If your Xcode AI plugin supports custom OpenAI endpoints, fill in the Base URL, API Key, and Model.

4. Agent Configuration

4.1 OpenClaw

OpenClaw is a locally-run personal AI assistant that integrates with messaging platforms for remote control.

4.1.1 Install and Launch Configuration Wizard

curl -fsSL https://openclaw.bot/install.sh | bash

After installation, the config wizard starts automatically. If not, run:

openclaw configure
1

Choose Gateway Runtime Location

GatewayLocal (this machine)
2

Select Configuration Section

SectionsModel
3

Select Provider

ProviderOpenAI Compatible

4.1.2 Manual API Key Configuration

After selecting OpenAI Compatible in Model/auth provider, fill in the following:

1

Fill in API Base URL

Base URLhttps://test-api.computeflux.ai/v1
2

Fill in API Key

API KeyYour ComputeFlux API Key
3

Fill in Model

Modelmy-provider/gpt-4o

4.1.3 Verify

After configuration, run the following command to enter the TUI chat. A normal response means success.

openclaw tui

4.2 Claude Code

Some ComputeFlux providers support the Claude (Anthropic) format. If your model backend has this enabled, point Claude Code to ComputeFlux via the following environment variables:

export ANTHROPIC_BASE_URL="https://test-api.computeflux.ai/anthropic"
export ANTHROPIC_API_KEY="<your-computeflux-api-key>"
export ANTHROPIC_MODEL="my-provider/gpt-4o"
claude

The actual model invoked is mapped by the backend based on the model name requested by Claude Code.

4.3 Hermes Agent

config.yaml:

llm:
  provider: openai
  base_url: https://test-api.computeflux.ai/v1
  api_key: <your-computeflux-api-key>
  model: my-provider/gpt-4o

5. Personal Compute Client Access

Download Client

Download the client for your operating system:

Log in to Client

After installation, open the client and log in with your wallet.

Log in to Client

Enable Model Forwarding

Enable model forwarding in the client to start mining.

Enable Model Forwarding

6. Personal Compute CLI Access

Download and Install CLI

Linux users can run the following command to download and install computeflux-cli:

sudo curl -fsSL \
  /client/computeflux-cli-0.0.1 \
  -o /usr/local/bin/computeflux-cli \
  && sudo chmod +x /usr/local/bin/computeflux-cli

Get API Key

Create and copy your Gateway API Key in the Dashboard:

ActionLog in to ComputeFlux DApp and go to /dashboard/api-keys to create a Gateway API Key

Create models.json

Choose your model backend type, copy the config and save it as models.json:

{
  "apiKey": "<gateway-api-key>",
  "models": {
    "qwen2.5": {
      "ollama": {
        "url": "http://localhost:11434",
        "providerType": 0,
        "apiKey": ""
      }
    }
  }
}

Run computeflux-cli

Run the following command in the directory containing the config file:

computeflux-cli --config ./models.json

5. Observability

7.1 Langfuse

from langfuse import Langfuse
      from langfuse.openai import openai

      langfuse = Langfuse(
          public_key="<langfuse-public-key>",
          secret_key="<langfuse-secret-key>",
          host="https://cloud.langfuse.com",
      )

      client = openai.OpenAI(
          base_url="https://test-api.computeflux.ai/v1",
          api_key="<your-computeflux-api-key>",
      )

      response = client.chat.completions.create(
          model="my-provider/gpt-4o",
          messages=[{"role": "user", "content": "Hello, ComputeFlux!"}],
      )

FAQ

Q1: Getting 401 Unauthorized?
Make sure the API Key is created and not revoked at /dashboard/api-keys ; confirm the Authorization: Bearer <key> header is correct.
Q2: Getting 404 Not Found?
Make sure the Base URL ends with /v1 and the model name is in <provider>/<model> format.
Q3: Model response slow?
ComputeFlux uses decentralized models. Providers may be serving many users, which can cause slow responses.
Q4: How is my API Key and user data protected from leaks?
ComputeFlux is built on an immutable blockchain system with fully open-source and auditable code, ensuring no data is ever stored or sold. The entire blockchain runs inside a TEE (Trusted Execution Environment), where no one can intercept or inspect data, providing high-level protection for your API Key and user data.