Skip to content
2api2api Docs
Open console

Other clients

Other OpenAI-compatible clients

Any client or SDK that supports a custom Base URL can connect to 2api in the OpenAI or Anthropic format.

Parameter GPT (a GPT group) Claude (CC-Max group)
Base URL https://2api.dev/v1 https://2api.dev
API Key sk-your-key sk-your-key
Model Look it up with /v1/models Look it up with /v1/models

The Claude group may only allow calls from the Claude Code client. If a third-party client reports only allows Claude Code clients, use the GPT group instead, or use Claude in Claude Code.

from openai import OpenAI
client = OpenAI(base_url="https://2api.dev/v1", api_key="sk-your-key")
resp = client.chat.completions.create(
model="model-name",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

In Cursor’s settings, turn on Override OpenAI Base URL and enter https://2api.dev/v1. Enter your key as the API key, then add the model name by hand. A few limits:

  • Cursor sends requests from its own servers, so it only accepts a public address (2api.dev works).
  • Don’t give a custom model the same name as one of Cursor’s built-in models.
  • Agent mode sometimes reports Missing required parameter: 'messages'. This is a compatibility problem on Cursor’s side. If you hit this error with GPT in Cursor, install the Codex extension instead.