TokenFund
DOCUMENTATION

Integration guide

Point any OpenAI-compatible tool at your TokenFund API key to start routing requests through your project wallet.

Quickstart

Get your API key from your project dashboard, then swap your existing base URL and key. No SDK changes needed — TokenFund speaks OpenAI's protocol.

Credentials

Use these values in your OpenAI-compatible client

Base URL

https://tokenfund.dev/api/v1

API Key

tf_proj_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Get your key: Go to Dashboard → open your project → copy the API key from the top card. It starts with tf_proj_.

Roo Code

Roo Code supports custom OpenAI-compatible providers. Set it up once per project or globally.

01

Open Roo Code settings

Click the gear icon in the Roo Code panel, or open the VS Code command palette and run Roo-Code: Open Settings.
02

Select "OpenAI Compatible" as provider

In the API Provider dropdown, choose OpenAI Compatible.
03

Enter your credentials

Fill in the following fields:

Roo Code
Base URL:  https://tokenfund.dev/api/v1
API Key:   tf_proj_your_key_here
Model:     claude-sonnet-4-5
04

Save and start coding

Roo Code will now route all requests through your TokenFund project wallet. Usage appears in your project dashboard within seconds.

Cline

Cline (formerly Claude Dev) supports custom OpenAI-compatible endpoints.

01

Open Cline settings

Click the settings icon in the Cline sidebar panel.
02

Choose "OpenAI Compatible"

Set API Provider to OpenAI Compatible.
03

Configure the endpoint

Cline
OpenAI API Key:     tf_proj_your_key_here
OpenAI Base URL:    https://tokenfund.dev/api/v1
Model ID:           claude-sonnet-4-5

Cursor

Cursor supports custom models via its OpenAI-compatible settings.

01

Open Cursor settings

Press ⌘ , to open settings, then go to Models.
02

Add a custom model

Scroll to OpenAI API Key and enable Override OpenAI Base URL.
03

Enter your credentials

Cursor
API Key:   tf_proj_your_key_here
Base URL:  https://tokenfund.dev/api/v1

Then add a custom model name matching one from the supported models list below.

Code examples

TokenFund is a drop-in replacement for the OpenAI SDK base URL. No other changes needed.

curl https://tokenfund.dev/api/v1/chat/completions \
  -H "Authorization: Bearer tf_proj_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 256
  }'

Proxy API

Use the Proxy API to forward requests to provider endpoints (models list, search, generation stats, etc.). For chat completions and messages with wallet billing, use /api/v1/chat/completions. The proxy forwards everything else. Streaming works where the upstream supports it.

Proxy base URL

Base URL for all proxy requests

https://tokenfund.dev/api/proxy/{provider}/{path}

Example: https://tokenfund.dev/api/proxy/anthropic/v1/messages

Supported providers

ProviderUpstreamExample path
OpenAIhttps://api.openai.com/api/proxy/openai/v1/chat/completions
Anthropichttps://api.anthropic.com/api/proxy/anthropic/v1/messages
OpenRouterhttps://openrouter.ai/api/proxy/openrouter/api/v1/chat/completions
Exa AIhttps://api.exa.ai/api/proxy/exa/search
Fal AIhttps://fal.run/api/proxy/fal/fal-ai/llava/run
Fal AI (Queue)https://queue.fal.run/api/proxy/fal-queue/fal-ai/llava/run

Proxy examples

Anthropic Messages API and OpenRouter chat

Anthropic /v1/messages

curl https://tokenfund.dev/api/proxy/anthropic/v1/messages \
  -H "Authorization: Bearer tf_proj_your_key" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-5","max_tokens":256,"messages":[{"role":"user","content":"Hello"}]}'

OpenRouter models list

curl "https://tokenfund.dev/api/proxy/openrouter/api/v1/models" \
  -H "Authorization: Bearer tf_proj_your_key"

Exa AI search

curl https://tokenfund.dev/api/proxy/exa/search \
  -H "Authorization: Bearer tf_proj_your_key" \
  -H "Content-Type: application/json" \
  -d '{"query":"machine learning","numResults":5}'

Set the provider's API key in your environment (e.g. ANTHROPIC_API_KEY, OPENROUTER_API_KEY, EXA_API_KEY, FAL_KEY) for platform billing. For hackathons, organizer keys are used when configured.

Supported models

Pass the model name in the model field. Anthropic models are converted from OpenAI format automatically.

Anthropic (Claude)

ModelInput / 1MOutput / 1MNote
claude-opus-4-6$5.00$25.00Most intelligent
claude-sonnet-4-5$3.00$15.00Recommended for coding tools
claude-haiku-4-5$1.00$5.00Fast & affordable
claude-3-haiku-20240307$0.25$1.25Cheapest (legacy)

OpenAI

ModelInput / 1MOutput / 1MNote
gpt-5$1.25$10.00Most capable
gpt-4.1$2.00$8.00Great for coding
gpt-4.1-mini$0.40$1.60Fast & cheap
gpt-4o-mini$0.15$0.60Cheapest

Prices per 1M tokens. Older versioned model IDs (e.g. claude-sonnet-4-5-20250929) are also supported.

Error reference

CodeNameDescription
401AUTH_ERRORMissing or invalid API key. Check that your key starts with tf_proj_ and has no extra spaces.
402INSUFFICIENT_BALANCEProject wallet is empty. Share your donation page to get more credits.
429RATE_LIMIT_EXCEEDEDToo many requests. Default limit is 10 requests/minute per project.
400VALIDATION_ERRORMissing or invalid request fields (e.g. no model specified).
502PROVIDER_ERRORUpstream error from Anthropic or OpenAI. Retry the request.