OpenAI / Anthropic Compatibility

The gateway speaks both wire protocols natively with the same sk- key as a Bearer token. Exact request and response shapes for every endpoint are in the agent reference - this page only covers SDK setup.

OpenAI SDK

Change only the base URL:

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-xxxx',
  baseURL: 'https://tokpum.com/v1',
});

const res = await client.chat.completions.create({
  model: 'gpt-4o',
  messages: [{ role: 'user', content: 'Hello' }],
});

Streaming: pass stream: true and consume chunks exactly as with OpenAI - see the SSE streaming pattern.

Anthropic SDK

The gateway does NOT accept the Anthropic SDK's default x-api-key header. Keep the official base URL style but pass the key as a Bearer token:

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

const client = new Anthropic({
  apiKey: 'sk-xxxx',
  baseURL: 'https://tokpum.com',
  defaultHeaders: { Authorization: 'Bearer sk-xxxx' },
});

const res = await client.messages.create({
  model: 'claude-3-5-sonnet-20241022',
  max_tokens: 100,
  messages: [{ role: 'user', content: 'Hello' }],
});

Endpoint surfaces

OpenAI-compatible (base https://tokpum.com/v1):

Anthropic-compatible (base https://tokpum.com):

Video (async task API, OpenAI-style auth):

Agent tooling: POST /mcp - MCP server for self-onboarding and account management; see Agent Onboarding (MCP).

Plain HTTP

No SDK required. Every endpoint is a plain POST with a JSON body and an Authorization: Bearer sk-xxxx header - curl examples for each are in the reference pages above.