Base URLs and the OpenAI and Anthropic libraries
The base URL for each format, and how to use the OpenAI or Anthropic library with 5abeer by setting two environment variables.
5abeer accepts requests in three formats: the OpenAI format, the Anthropic Messages format and the Gemini format. Pick the base URL that matches the code or library you use, and send the key in that format's header.
The URLs#
https://api.5abeer.ai/v1Authorization: Bearer <KEY>https://api.5abeer.aix-api-key: <KEY>https://api.5abeer.ai/v1betax-goog-api-key: <KEY>Which format to use#
- OpenAI format, that is Chat Completions and Responses: for code built on the OpenAI library or its format. OpenAI-compatible: change the base URL and keep your code.
- Anthropic Messages format: for code built on the Anthropic library, and for tools such as Claude Code.
- Gemini format: compatible with the Gemini generateContent API for the models that support it.
You can call Claude models in the OpenAI format too. Each model's page in the models list shows the formats it supports.
The OpenAI library#
The official OpenAI library reads the base URL and the key from two environment variables, so your code stays as it is:
export OPENAI_BASE_URL="https://api.5abeer.ai/v1"
export OPENAI_API_KEY="YOUR_5ABEER_API_KEY"Then use the library as usual, with a 5abeer model id:
from openai import OpenAI
client = OpenAI() # reads OPENAI_BASE_URL and OPENAI_API_KEY
chat = client.chat.completions.create(
model="claude-sonnet-5.5",
messages=[{"role": "user", "content": "Hello"}],
)
print(chat.choices[0].message.content)
response = client.responses.create(model="claude-sonnet-5.5", input="Hello")
print(response.output_text)The openai library for JavaScript reads the same two variables. If you prefer to pass the values in code, set base_url to the URL and api_key to the key.
The Anthropic library#
The official Anthropic library reads two variables as well. Use the URL as it is, without /v1: the library adds the path itself.
export ANTHROPIC_BASE_URL="https://api.5abeer.ai"
export ANTHROPIC_API_KEY="YOUR_5ABEER_API_KEY"import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY
message = client.messages.create(
model="claude-sonnet-5.5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(message.content[0].text)Other tools#
If your tool accepts a custom base URL in the OpenAI or Anthropic format, give it three values: the base URL from the table above, your key, and the model id exactly as it appears in the models list. The common coding tools have ready guides:
Was this page helpful?