Developer Documentation

API Reference

Access OpenAI, Anthropic, and Google Gemini models through one gateway, using the SDKs you already know. Change two lines — the base URL and your key — and you're live.

Quickstart

Install the OpenAI SDK, point it at the AICreditMart endpoint, and use your API key.

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aicreditmart.com/v1/",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="gpt-5.4",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
That's it. The API is OpenAI-compatible — existing OpenAI SDK code works by changing only base_url and api_key.

Authentication

Pass your API key as the api_key in the SDK client. It's sent as a standard Bearer token and tracks your usage and billing.

key format
api_key = "sk-bf-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Keep your key private. If a key is exposed, contact us to rotate it.

Base URLs

Three endpoints, depending on which SDK you use:

OpenAI SDKhttps://api.aicreditmart.com/v1/
Anthropic SDKhttps://api.aicreditmart.com/anthropic
Gemini SDKhttps://api.aicreditmart.com/genai

Use the OpenAI base URL for all OpenAI models, the Anthropic base URL with the anthropic SDK for Claude models, and the Gemini base URL with Google's google-genai SDK for Gemini models.

Rate Limits

Rate limits are generous and set per API key. Most workloads run without hitting them. If you expect high sustained throughput or need a dedicated limit, contact us and we'll raise it for your key.

Regions

Models run primarily on US-based infrastructure (Azure US, Google US, and others). If you have data-residency requirements, EU region routing is available on request — contact us to enable it for your key.

Tracking Usage

Every account has a dedicated dashboard with real-time usage and cost tracking, broken down by model, tokens, and spend — so you always know exactly what you're using.

Sign in to view your usage at app.aicreditmart.com.

Anthropic Models

Use Anthropic's anthropic SDK pointed at the Anthropic base URL. Send the Model ID exactly as shown.

Text

Model IDNotes
claude-sonnet-5Latest Sonnet — top-tier intelligence at Sonnet pricing
claude-opus-4-8Most capable Claude for complex challenges
claude-opus-4-7Previous Opus generation, highly capable
claude-opus-4-6Earlier Opus generation
claude-sonnet-4-6Fast, balanced model for everyday tasks
claude-haiku-4-5Fastest, most affordable Claude for high-volume tasks

Example — Text (claude-sonnet-4-6)

python
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.aicreditmart.com/anthropic",
    api_key="YOUR_API_KEY",   # your sk-bf virtual key, not a real Anthropic key
)

message = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1000,
    messages=[
        {"role": "user", "content": "Tell me about Stockholm in one sentence."}
    ],
)
print(message.content[0].text)

OpenAI Models

Send the Model ID exactly as shown.

Text & reasoning

Model IDNotes
gpt-5.6-solMost capable 5.6 model for complex reasoning
gpt-5.6-terraBalanced 5.6 model, strong price-performance
gpt-5.6-lunaFastest, most cost-efficient 5.6 model
gpt-5.5Frontier model with configurable reasoning
gpt-5.4Affordable model for coding and professional work
gpt-5.4-miniStrongest mini for coding and computer use
gpt-5.4-nanoCheapest 5.4-class model for high-volume tasks
gpt-5.2Previous frontier model, configurable reasoning
gpt-5.1Strong coding and agentic tasks, configurable reasoning
gpt-5Reasoning model for coding and agentic tasks
gpt-5-miniNear-frontier, low-latency, high-volume workloads
gpt-5-nanoFastest, most cost-efficient GPT-5
gpt-4.1Smartest non-reasoning model
gpt-4.1-miniSmaller, faster GPT-4.1
gpt-4.1-nanoFastest, most cost-efficient GPT-4.1
gpt-4oFast, intelligent, flexible multimodal model
gpt-4o-miniFast, affordable model for focused tasks

Image

Model IDNotes
gpt-image-2State-of-the-art image generation
gpt-image-1.5Previous-generation image model
gpt-image-1-miniCost-efficient image generation

Video

Model IDNotes
sora-2Flagship video generation with synced audio

Embeddings

Model IDNotes
text-embedding-3-largeMost capable embedding model
text-embedding-3-smallSmall, fast embedding model

Example — Text (gpt-5.4)

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aicreditmart.com/v1/",
    api_key="YOUR_API_KEY",
)

response = client.chat.completions.create(
    model="gpt-5.4",
    messages=[{"role": "user", "content": "How far is New York from London?"}],
)
print(response.choices[0].message.content)
print(f"Tokens used: {response.usage.total_tokens}")

Example — Image (gpt-image-2)

python
from openai import OpenAI
import base64

client = OpenAI(
    base_url="https://api.aicreditmart.com/v1/",
    api_key="YOUR_API_KEY",
)

response = client.images.generate(
    model="gpt-image-2",
    prompt="A majestic horse standing in a field",
    n=1,
    size="1024x1024",
    quality="medium",
    output_format="png",
)

if response.data[0].b64_json:
    img = base64.b64decode(response.data[0].b64_json)
    with open("horse.png", "wb") as f:
        f.write(img)
    print("Saved horse.png")

Example — Video (sora-2)

python
import time
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aicreditmart.com/v1/",
    api_key="YOUR_API_KEY",
)

# 1. Create the video
video = client.videos.create(
    model="sora-2",
    prompt="A cat playing piano in a jazz bar",
    size="1280x720",
    seconds="4",
)

# 2. Poll until complete
while video.status in ["queued", "in_progress"]:
    time.sleep(5)
    video = client.videos.retrieve(video.id)
    print(f"Status: {video.status}")

# 3. Download
if video.status == "completed":
    content = client.videos.download_content(video.id, variant="video")
    content.write_to_file("output.mp4")
    print("Saved output.mp4")

Example — Embeddings (text-embedding-3-small)

python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.aicreditmart.com/v1/",
    api_key="YOUR_API_KEY",
)

response = client.embeddings.create(
    model="text-embedding-3-small",
    input="The quick brown fox jumps over the lazy dog.",
)
print(f"Dimensions: {len(response.data[0].embedding)}")

Google Gemini Models

Use Google's google-genai SDK pointed at the Gemini base URL. Send model names with the models/ prefix.

Text

Model IDNotes
gemini-3.5-flashMost intelligent flash for agentic and coding
gemini-3.5-flash-liteFast, low-cost model for high-volume tasks
gemini-3.1-pro-previewAdvanced reasoning and agentic coding (preview)
gemini-3.1-flash-liteFrontier-class performance at low cost
gemini-3-flash-previewFrontier-class performance, low cost (preview)
gemini-2.5-proAdvanced reasoning and coding for complex tasks
gemini-2.5-flashBest price-performance for high-volume reasoning
gemini-2.5-flash-liteFastest, most budget-friendly 2.5 model

Image

Model IDNotes
gemini-3-pro-imageStudio-quality 4K image generation and editing
gemini-3.1-flash-imageHigh-efficiency image generation, optimized for speed
gemini-2.5-flash-imageNative image generation for fast creative workflows

Example — Text (gemini-3.5-flash)

python
from google import genai
from google.genai import types

client = genai.Client(
    api_key="YOUR_API_KEY",
    http_options=types.HttpOptions(base_url="https://api.aicreditmart.com/genai"),
)

response = client.models.generate_content(
    model="models/gemini-3.5-flash",
    contents="Tell me about London in one sentence.",
)
print(response.text)

Example — Image (gemini-3.1-flash-image)

python
from google import genai
from google.genai import types

client = genai.Client(
    api_key="YOUR_API_KEY",
    http_options=types.HttpOptions(base_url="https://api.aicreditmart.com/genai"),
)

MODEL = "gemini-3.1-flash-image"
r = client.models.generate_content(
    model=f"models/{MODEL}",
    contents="A photorealistic golden retriever wearing a red cape, studio lighting",
    config=types.GenerateContentConfig(response_modalities=["IMAGE"]),
)

for part in r.candidates[0].content.parts:
    if part.inline_data and part.inline_data.data:
        with open(f"{MODEL}.png", "wb") as f:
            f.write(part.inline_data.data)
        print(f"Saved {MODEL}.png")
Higher resolution. Gemini image models scale by resolution. Add image_config=types.ImageConfig(image_size="4K") inside the config for up to 4K (on gemini-3.1-flash-image and gemini-3-pro-image).
Need a key, higher limits, or a model that isn't listed? Contact your AICreditMart account manager.