1. Select models available to your accounts
Create an account with each provider and load its API key into the environment variable below using your secret manager. Each API usesAuthorization: Bearer authentication. The script reads keys from the environment and does not print headers or keys.
Select a text chat model accessible on your account’s service tier. Record its model family, context limit, reasoning behavior, and preview status. Where providers offer equivalent checkpoints, use them; otherwise compare both against the same task rubric. Model names can differ across providers.
In Bash, enter the selected IDs:
2. Send one bounded request to each API
Save this ascompare_apis.py and run it with Python 3.10 or later. It sends three completion requests total, without automatic retries. Running it may consume your API credits.
3. Score correctness before accepting a latency result
For this task, require the output to equalTF-1042 after trimming whitespace. Record a separate correctness pass and whether the response met your application deadline. HTTP 200 alone is insufficient. Treat empty, malformed, truncated, and incorrect answers as failures; record missing usage as unknown rather than zero.
If finish_reason is length, the output budget may have been consumed before a final answer. Reasoning defaults differ between models. Choose supported settings or raise the shared budget, then label and rerun the comparison. For 401/403, check account access; for 429, inspect the provider’s quota and rate limits before retrying.
elapsed_seconds measures the complete non-streaming HTTP operation from this client, including connection setup, network travel, scheduling, generation, and response reading. It does not measure time to first token. Three requests establish connectivity and a smoke test, not reliable latency percentiles. A larger evaluation should use representative inputs, repeated runs, controlled request rates, and the same client region.

