Skip to content

Repository files navigation

OpenAI-Compatible API Migration Kit

observed unit price billing model OpenAI-compatible endpoint

image2.5 from $0.0085 per 1K image · Seedance 2.5 from $0.0961/sec · cached LLM input from $0.40/M — one OpenAI-compatible endpoint at https://api.apimart.ai/v1, no monthly plan required. (observed 2026-09-17)

Get an API key · Live pricing · ⚡ 60-second quickstart

Why teams route through APIMart

  • One key, entire catalog. The same https://api.apimart.ai/v1 base URL and Authorization header reach the whole catalog behind one key and 300+ other image, video and language models — switch the model field, not your client.
  • $1 minimum, pay as you go. No subscription and no prepaid plan to size up front: top up from $1 and spend it on calls. There is no free quota to burn through first, so the price in this table is the price you pay.
  • The charge comes back in the response. Every call reports the amount billed (cost / credits_cost), so a spend number is read per call instead of guessed at month end.
  • Async by design. Submit, take the task_id, poll GET /v1/tasks/{id} — batching and retries are ordinary queue work, not a bespoke integration.

OpenAI-compatible API migration kit — runnable Python, JavaScript and cURL examples for moving an OpenAI-compatible workload between API gateways without hard-coding credentials, and without pretending that changing one URL proves full compatibility.

Use this repository when evaluating an OpenAI API proxy, AI API gateway, LLM API relay, or OpenAI-compatible API.

What this kit checks

Migration surface Included example What still needs a real test
Chat Completions Python, JavaScript, cURL model availability, usage fields, errors
Streaming / SSE Python event order, disconnects, cancellation
Tool calling Python argument schema, duplicate execution, finish reason
JSON / structured output checklist + scanner schema adherence and refusal behavior
Vision input checklist + scanner media limits, URL/data URI handling and cost
Responses API checklist + scanner endpoint and event compatibility
Authentication environment variables only key scopes, revocation and sub-key controls
Rollback configuration-only switch in-flight requests, retries and idempotency

Quick start with APIMART

APIMART documents an OpenAI-compatible base URL at https://api.apimart.ai/v1. Keep the provider settings in environment variables so rollback does not require a code change.

cp .env.example .env
# Add a newly created key to .env; never commit it.
export OPENAI_API_KEY="..."
export OPENAI_BASE_URL="https://api.apimart.ai/v1"
export OPENAI_MODEL="gpt-5-mini"

Python:

python -m pip install openai
python examples/python_chat.py

JavaScript:

npm install
node examples/javascript_chat.mjs

cURL:

./examples/curl_chat.sh

Official APIMART references: Quick start · documentation index.

Scan an existing project before switching

python openai_migration_check.py /path/to/your/project

The scanner reports migration-sensitive code paths—streaming, tools/functions, structured output, vision, Responses API, custom base URLs, and possible hard-coded keys. It never uploads source code.

Exit codes:

  • 0: scan completed and no possible hard-coded key was found;
  • 2: scan completed and a possible hard-coded key requires review;
  • 64: invalid command input.

Migration sequence

  1. Freeze a representative request set and acceptance rules.
  2. Move base URL, key, and model ID to configuration.
  3. Run chat, streaming, tools, JSON, vision, and Responses checks that your application actually uses.
  4. Compare successful usable outputs, p50/p95 latency, retries, 429 behavior, and total cost per usable output.
  5. Canary 1% → 5% → 25%; preserve idempotency keys and an independent rollback route.
  6. Roll back by restoring the previous environment values—not by editing application code.

See COMPATIBILITY.md for the complete contract and ROLLBACK.md for the rollback drill.

What that costs at scale

Workload Cost at the observed rates
1,000 GPT Image 2.5 renders (1K) $8.50
10 minutes of Seedance 2.5 at 480P (600s) $57.66
1M cached LLM input tokens from $0.40

Linear at the observed per-unit rate, no volume discount assumed. Snapshot 2026-09-17; re-check the live table before committing a budget.

First-call troubleshooting

Symptom Likely cause Fix
401 / invalid api key key missing, truncated, or a stray newline pasted into the header Re-copy it from the console; the header is Authorization: Bearer $APIMART_API_KEY
balance / credit error the account has no balance Top up from $1 in the console — there is no free quota to fall back on
429 concurrent requests on one key Back off, then retry the same request with the same Idempotency-Key
400 / model not found wrong route for the id: the per-unit alias needs its version, the official id must not send one Copy the exact model value from the route table above
task ends failed prompt rejected by the filter, or a reference image URL expired Re-submit with a new Idempotency-Key and re-host the reference image
result URL stops working result links expire Download the file as soon as the task reports completed

Start with $1. Get an API keycheck live pricing. The first call is three steps: submit, poll task_id, read the charged amount off the response.

Attributed links (how this repository is measured)

Purpose Attributed link Target
Browse the model catalog https://go.apimart.ai/k-756372 apimart.ai
Current pricing page https://go.apimart.ai/k-44948b apimart.ai/pricing
Get an API key https://go.apimart.ai/k-f16051 apimart.ai/keys

If a single account for multiple text, image and video models fits your evaluation, create an APIMART account with this attributed link and run the same fixed test set against APIMART and your current route.

APIMART is one candidate, not an unconditional winner. Model identity, limits, failure billing, retention, regions, fallback behaviour and SLA must be verified for your account and workload.

Outbound APIMart links are minted through the promo link API (go.apimart.ai); hand-made tracking parameters are rejected by tools/check_links.py in CI.

Disclosure

This repository documents an OpenAI-compatible migration procedure; it is published to document that procedure, not to claim official status for any vendor. Product names, model names and documentation belong to their respective owners, and relayed routes are third-party relay endpoints rather than first-party vendor endpoints.

Repository map

README.md                  migration checklist, quickstart and attributed links
COMPATIBILITY.md           the compatibility contract per migration surface
ROLLBACK.md                rollback drill
openai_migration_check.py  scanner for migration-sensitive code paths
examples/                  Python, JavaScript and cURL clients (chat, streaming, tools)
tests/                     unit tests for the scanner
tools/check_links.py       attribution guard (CI)
.github/workflows/         verify + validate

License

MIT — see LICENSE.

About

OpenAI-compatible API migration kit: drop-in /v1/images/generations and chat examples, a compatibility matrix, rollback switches and a checklist for moving workloads between AI API gateways.

Topics

Resources

Contributing

Security policy

Stars

60 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages