OpenAI and Anthropic SDKs

OpenAI and Anthropic SDKs

Connecting the official OpenAI and Anthropic SDKs for Python and Node.

The official SDKs work with the gateway without code changes — set the base URL and the key.

OpenAI SDK

from openai import OpenAI

client = OpenAI(base_url="https://ai-seller.vibe-codes.ru/v1", api_key="$AISELLER_API_KEY")
resp = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Without parameters the client reads the OPENAI_BASE_URL and OPENAI_API_KEY variables:

bash
export OPENAI_BASE_URL=https://ai-seller.vibe-codes.ru/v1
export OPENAI_API_KEY=$AISELLER_API_KEY

The same client works with Responses (client.responses.create) and images (client.images.generate).

Anthropic SDK

import anthropic

client = anthropic.Anthropic(base_url="https://ai-seller.vibe-codes.ru", api_key="$AISELLER_API_KEY")
msg = client.messages.create(
    model="gpt-5.6-sol",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(msg.content[0].text)

The base URL has no /v1: the SDK appends /v1/messages itself. Without parameters the client reads ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY.

The Anthropic SDK goes through /v1/messages, and the gateway does not translate formats: only a model whose provider supports Anthropic Messages will work (see Messages).

Retries and timeouts

  • Both SDKs retry 429 and 5xx themselves, honoring the Retry-After header — no extra retry code needed.
  • For images, video and reasoning models increase the client timeout: generation may take minutes.

Updated September 29, 2026