الجواب المباشر

تشرح هذه الصفحة كيف تستخدم الفرق بوابة NextModel المتوافقة مع OpenAI. Migration, billing boundaries, limits, and the questions support answers most. وتضيف الخطوات العملية، وملاحظات الإعداد، والأسئلة الشائعة.

Do I need to change code to migrate from OpenAI or Anthropic?

No. Swap two values: base_url → https://api.nextmodel.app (OpenAI tools usually append /v1 themselves; Anthropic tools take the bare host because the gateway serves /v1/messages on the same path) and the key → a NextModel key. SDKs, request shapes, and streaming work unchanged. The one field to also set is model — it must be a catalog id from GET /v1/models.

What exactly is a failed request billed?

Nothing. Reservations settle only after a response is delivered in full; provider errors, mid-stream failures, and client disconnects all roll back. Every response's X-NextModel-Billing-Status header proves which happened.

Why does my model call return model_not_supported?

The id is not in the live catalog. Copy it from GET /v1/models including the provider prefix; display names and bare shortcuts are not valid ids. See Model ID rules.

Do you support Gemini- or DashScope-native protocols?

Not yet. Gemini, Qwen and other vendor-native families are called through the OpenAI-compatible endpoints with their catalog ids; dedicated native paths are on the roadmap and currently return 501 protocol_runtime_not_routed.

Is streaming supported?

Yes — set stream: true for SSE on chat, responses, and messages endpoints.

Is function calling / tool use supported?

Yes on models whose catalog capabilities include Function Calling (visible in GET /v1/models). Pass tools in the standard OpenAI or Anthropic shape for the endpoint you are calling.

What are the rate limits?

Rate limits are per-account and per-key; exceeding them returns 429 with a Retry-After header. The current deployment allows 6,000 requests per minute per IP and per account. If you need a higher ceiling, contact support with your expected QPS.

Can I create multiple API keys?

Yes, and you should: split by environment (dev/staging/prod) or by project so /v1/activity and the dashboard attribute usage per key. Disabling a leaked key stops its calls immediately; disabled keys cannot incur charges.

How do I verify I got a real model response?

Beyond the response's model field and billing headers, NextModel issues verifiable provenance receipts — see /verifiable and the AI provenance doc — so an auditor can check the receipt against the gateway's proof, not just take the provider's word.

My stream died halfway. What do I check?

First confirm a non-streaming request works, then check client timeouts and proxies. A stream that does not complete cleanly rolls back the reservation — check X-NextModel-Billing-Status on the failed request — and the codes upstream_stream_idle_timeout / upstream_stream_total_timeout on the error identify where it stopped.

Does the platform modify my prompts or responses?

No. The gateway forwards requests and relays provider responses; it does not rewrite contents. Failed egress translation is surfaced as a 502 egress_translation_failed rather than silently mangled output.

Is my data recorded?

The gateway logs metadata — time, model, token counts, cost, status — for billing and reliability. Prompt and completion bodies are not retained beyond request logs needed for the product's dashboard and idempotent-replay guarantees.