AI Task Manager

OpenAI / Anthropic-compatible API

The Task Manager can stand in for the OpenAI or Anthropic API. Point any app, script or tool built for either API at the base URL below and give it a Task Manager API key. Its requests then run on the AI provider chosen for that key (your default provider unless you pick another), whichever vendor that is. A tool written for OpenAI can run on your Claude subscription, and the reverse, with no code changes.

Setup

1. Create an API key

Go to Settings → API and create a key named after the service that will use it. These are the same keys the REST API uses. The key is shown once, so copy it straight away. Send it wherever the service expects its OpenAI or Anthropic key. Both Authorization: Bearer … and x-api-key: … are accepted.

2. Check which provider will answer

Each key has a Provider setting, chosen when you create it and changeable later in the key list in Settings → API, just like a task's AI Provider. Default provider runs requests on the same provider a new task would get: if the Smart Provider Picker is on, it chooses; otherwise your default connection in Settings → AI answers. Smart Provider always picks the best available connection on each request. Picking one connection pins the key to it, so different services can run on different accounts. If the chosen connection is disabled, deleted or rate-limited, the request falls back to the default chain and any other enabled connection takes over. The client doesn't need to change.

3. Point your client at it

Replace tm_live_YOUR_KEY with your key. Swap http://localhost:3000 for your own deployment's address.

OpenAI · Python

from openai import OpenAI

client = OpenAI(base_url="http://localhost:3000/api/llm/v1", api_key="tm_live_YOUR_KEY")

reply = client.chat.completions.create(
    model="default",
    messages=[{"role": "user", "content": "Summarise the plot of Hamlet in one line."}],
)
print(reply.choices[0].message.content)

OpenAI · TypeScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "http://localhost:3000/api/llm/v1", apiKey: "tm_live_YOUR_KEY" });

const stream = await client.chat.completions.create({
  model: "default",
  stream: true,
  messages: [{ role: "user", content: "Write a haiku about queues." }],
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");

Anthropic · Python

import anthropic

client = anthropic.Anthropic(base_url="http://localhost:3000/api/llm", api_key="tm_live_YOUR_KEY")

message = client.messages.create(
    model="default",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Summarise the plot of Hamlet in one line."}],
)
print(message.content[-1].text)

Anthropic · TypeScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ baseURL: "http://localhost:3000/api/llm", apiKey: "tm_live_YOUR_KEY" });

const stream = client.messages.stream({
  model: "default",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Write a haiku about queues." }],
});
stream.on("text", (text) => process.stdout.write(text));
await stream.finalMessage();

cURL

# OpenAI format
curl http://localhost:3000/api/llm/v1/chat/completions \
  -H "Authorization: Bearer tm_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"default","messages":[{"role":"user","content":"Hello"}]}'

# Anthropic format
curl http://localhost:3000/api/llm/v1/messages \
  -H "x-api-key: tm_live_YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"default","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'

Environment variables

# Many tools and SDKs read these instead of taking a base URL in code.
export OPENAI_BASE_URL="http://localhost:3000/api/llm/v1"
export OPENAI_API_KEY="tm_live_YOUR_KEY"

export ANTHROPIC_BASE_URL="http://localhost:3000/api/llm"
export ANTHROPIC_API_KEY="tm_live_YOUR_KEY"

Choosing a model

Clients keep sending the model name they were built for. The gateway decides whether to use it:

Model sentWhat runs
defaultThe provider's configured model (also for auto, or no model at all).
A model from the provider's vendorUsed as sent, e.g. claude-haiku-4-5 on a Claude provider or gpt-5.5 on Codex.
A model from the other vendorReplaced by the provider's configured model, so an app hard-wired to gpt-4o still works on Claude.
An unrecognised nameUsed as sent on OpenAI-compatible connections and connections with a custom base URL (self-hosted models, gateway aliases). Otherwise the provider's model is used.

Where the provider reports it, the model field in each response names the model that actually ran.

What works on each provider

When the request format matches the provider's own API, it is passed straight through. Otherwise it is translated, in both directions, including streaming.

Provider typeStreamingTool callingImages / PDFsNotes
Anthropic API / Claude PKIYesYesYesAnthropic-format requests pass through unchanged, including anthropic-beta headers.
OpenAI-compatibleYesYesYesOpenAI-format requests pass through unchanged.
Claude Code (subscription)Yes, token by token (in one chunk when your own tools are sent)Yes, emulated, plus web search/fetch and MCPYesRuns claude -p. See "Subscription CLIs" below.
Codex (subscription)Sent in one chunk at the endYes, emulated, plus MCPNoRuns codex exec read-only. No web search/fetch or images.

Translation notes

Endpoints

EndpointFormatDescription
POST /api/llm/v1/chat/completionsOpenAIChat Completions. Set stream: true for SSE chunks ending in [DONE]; stream_options.include_usage adds a final usage chunk.
POST /api/llm/v1/messagesAnthropicMessages API, streaming or not. Streams use the standard event types (message_start, content_block_delta, …).
POST /api/llm/v1/messages/count_tokensAnthropicExact on Anthropic API providers. An estimate (about 4 characters per token) on other providers.
GET /api/llm/v1/modelsBothThe models the current provider can run, starting with default. Each entry has the fields both SDKs read.

Errors

Errors use the same shape as the API the client called, so SDKs raise their usual exception types. Errors from an upstream API keep their original status. If an error happens after a stream has started, it arrives as an error event in the stream.

StatusMeaning
400The request can't run on this provider, e.g. code execution sent to a subscription CLI, images sent to Codex, or a conversation that doesn't end with a user message.
401Missing or invalid API key. MCP tokens (tm_mcp_…) don't work here.
429The provider is rate-limited or out of plan usage, and no other provider is available. Retry later.
502The provider failed to answer (the CLI crashed, a network error, …).
503No provider is configured or enabled, the CLI isn't installed, or its login has expired — or the gateway has been temporarily disabled (the message says until when, and timed pauses send Retry-After).

Good to know