
OpenAI SDK with a custom base URL: text, streaming and images
Change base_url and api_key in the OpenAI client library and keep the rest of the code: chat completions, streaming, tool calls and image generation at exact sizes.
Guides for developers: point the client you already run at the gateway, read what comes back, and keep the bill predictable.

Change base_url and api_key in the OpenAI client library and keep the rest of the code: chat completions, streaming, tool calls and image generation at exact sizes.

Give each API key its own spending ceiling and reset period, read what is left from GET /api/v1/key, and stop a batch before it runs into a 402.

What 429 and 503 ask of your client: read Retry-After, back off with jitter, cap the attempts, and know which errors are never worth retrying.

Ask for exact pixels or a tier and an aspect ratio: what size comes back, where the fields go, what is refused with 400 and what sets the price.

Two environment variables move a terminal coding agent onto a gateway: the base URL and a bearer token. What to set, how to check it, and what stops the first call.

Every chat completion reports what it charged in usage.cost. Find it in a reply and a stream, log it per request and check the sums against the key route.

Point the Messages API client libraries at a different endpoint: the base URL, an auth token instead of an API key, streaming, token usage and typed errors.

Why an API call comes back 402 payment_required: the prepaid balance, a key spend limit or an account ceiling. How to tell which, and what to do.
No posts match. Try another word, or pick a topic above.