FAQ

General

How is TokenCode different from calling OpenAI/Claude APIs directly?

TokenCode is an AI API aggregation gateway. With TokenCode, you can:

  • Access all models from 40+ providers with a single API Key
  • Use automatic protocol conversion without adapting different SDKs for different models
  • Benefit from intelligent routing, failover, and load balancing
  • Manage everything through a unified billing and management dashboard

Calling each provider directly requires registering separate accounts, managing multiple API Keys, and adapting to different protocols.

How does automatic protocol conversion work?

When you call a Claude model through the OpenAI protocol, TokenCode:

  1. Receives the OpenAI-format request
  2. Converts it to Anthropic native format and sends it to the upstream
  3. Converts the Anthropic native response to OpenAI format and returns it to you

The reverse works the same way — calling an OpenAI model through the Anthropic protocol is also automatically converted. The entire process is completely transparent to the client.

What models are supported?

Models from 40+ providers are supported, including OpenAI, Anthropic, Google, AWS Bedrock, Azure, DeepSeek, Mistral, and Meta. For the complete model list, visit the homepage or query via the GET /v1/models endpoint.

Account & Billing

How do I top up?

Log in to the Portal and select a top-up amount on the account page. A prepaid model is supported, and token costs are deducted from your balance in real time.

What happens when my balance runs out?

When your balance is depleted, API requests will return a 429 Too Many Requests error. Please top up promptly to restore service.

How do I view my usage?

Log in to the Portal and visit the usage page to view token consumption and cost breakdown by date and model.

Connection & Configuration

What is the API Base URL?

  • OpenAI protocol: https://tokencode.dev/v1
  • Anthropic protocol: https://tokencode.dev
  • Gemini protocol: https://tokencode.dev

Why does the OpenAI protocol Base URL have /v1 while Anthropic does not?

This follows the conventions of each protocol:

  • The OpenAI SDK appends paths like /chat/completions to the base URL by default, so the base URL needs to include /v1
  • The Anthropic SDK appends /v1/messages to the base URL by default, so the base URL should not include /v1

Is streaming supported?

Yes. All protocol endpoints support streaming output. Set stream: true to enable it.

Models & Features

Can I call OpenAI models through the Anthropic protocol?

Yes. TokenCode's automatic protocol conversion supports calling any model across protocols. When you call GPT-4o through the Anthropic protocol, the request and response are automatically adapted.

Is Function Calling supported?

Yes. Function Calling / Tool Use is correctly mapped during protocol conversion.

Is image input supported?

Yes. OpenAI, Anthropic, and Gemini protocols all support image input (Vision). See each protocol's API reference documentation for specific formats.

Is Extended Thinking supported?

Extended Thinking is a Claude-specific feature that is only available when calling Claude models through the Anthropic protocol. It is not supported when calling non-Claude models through protocol conversion.

Troubleshooting

Receiving a 401 Error

  • Check that your API Key is correct
  • Confirm the header format: Authorization: Bearer sk-xxx or x-api-key: sk-xxx
  • Verify that your API Key has not expired

Receiving a 429 Error

  • Insufficient balance: Top up in the Portal
  • Rate limit: Wait and retry

Receiving a 404 Error

  • Check that the request path is correct
  • Confirm the model name spelling is correct
  • Verify the Base URL configuration is correct (OpenAI protocol requires /v1)

Abnormal Response Format

  • Confirm that the protocol endpoint you're using matches your client
  • Check whether the model supports the feature you're using
  • Try making a direct request with curl to verify

Connection Timeout

  • Check whether your network can access tokencode.dev
  • Confirm the Base URL spelling is correct
  • If using a proxy, check your proxy configuration