OVERVIEW  ›  QUICKSTART

Quickstart

Use an OpenAI-compatible client, select a published model, and review each request in Activity. For now, we focus on the two highest-volume builder paths: Codex, then Claude Code.

Use the API

Keep your key in an environment variable. List models first, then use an ID that is available to your account.

import os
from openai import OpenAI

client = OpenAI(
  base_url="https://api.newtons.dev/v1",
  api_key=os.environ["NEWTONS_API_KEY"],
)

models = client.models.list().data
if not models: raise RuntimeError("No models published.")
response = client.chat.completions.create(
  model=models[0].id,
  messages=[{"role":"user","content":"Reply: connected"}],
  max_tokens=32,
)

Focused endpoints.

All API routes require Authorization: Bearer $NEWTONS_API_KEY.

MethodPathPurpose
GET/modelsList model IDs currently available to the account.
GET/pricingRead current USD rates and price versions.
GET/balanceRead purchased, reserved, and available credits.
POST/chat/completionsCreate text-only non-streaming or streaming completions.
POST/messagesClaude-compatible messages endpoint for Claude Code and Anthropic gateway integrations.
POST/responsesCreate a Responses API request. Check Apps for each coding tool’s current support status.

Use an app you already have.

Keep your coding flow and switch only the inference rail. For the largest cohort of builders, the default path is:

1) Codex (ChatGPT desktop) proof → 2) Claude Code gateway proof.We keep this sequence in all setup docs so users can stay productive while we harden route claims. Codex is the first continuity path being recertified because it is already part of the ChatGPT workflow and desktop surface.

Research note (as of Aug 29, 2026): Codex is documented as a dedicated coding workflow in ChatGPT, included across ChatGPT plans, and provider mode works through the Codex profile/config path. Anthropic confirms gateway routing points through ANTHROPIC_BASE_URL; base URL alone does not replace active subscription auth. Codex in OpenAI Help · Using Codex with ChatGPT · Claude gateway docs.Read our routing research.

Codex (ChatGPT workflow)

Experimental

The current route is not certified for full Codex agent turns. Streaming and function tools still require verification. Test this profile only in a non-sensitive workspace. In the same Codex session: run /status, confirm the active provider is newtons, and complete one low-risk repo task.

model = "gpt-5.6-sol"model_provider = "newtons"[model_providers.newtons]base_url=https://api.newtons.dev/v1name = "Newton's"env_key = "NEWTONS_API_KEY"wire_api = "responses"

Desktop config reads user/provider settings from ~/.codex/config.toml; keys should be sourced from ~/.codex/.env. This is especially important because desktop and IDE sessions do not always inherit shell variables.

Suggested validation: run /status then /v1/models in the same Codex session.

Rollback: restore your prior profile and verify /v1/models is now from your preferred provider.

Claude Code

Integration assistant

Current status: setup + readiness checks are available, and routing must be confirmed with receipts before production use.

ANTHROPIC_BASE_URL=https://api.newtons.dev/v1ANTHROPIC_AUTH_TOKEN=<Newton's gateway token>// orANTHROPIC_API_KEY=<Newton's API-key-style token>

Critical: ANTHROPIC_BASE_URL only points traffic. For Newton's billing/routing to apply, the session auth must also use the gateway credential.

Important auth rule: if you only set ANTHROPIC_BASE_URL, Claude login remains active and billing stays on Anthropic. Set one gateway credential so the session reports the gateway in /status.

Verification: run /status and confirm both an active Anthropic base URL and gateway auth source.

Session caveat: apply variables in the process/session context that starts Claude Code (shell, host settings, or managed config).

Fallback: keep native Anthropic auth for production traffic until receipts are verified end-to-end.

Why this order

Flow reasoning

In builder overflow moments, most users need continuity first. Test Codex only in a non-sensitive workspace while its route is experimental. Claude Code remains an assisted setup path until its gateway certification is complete. That keeps continuity first, and avoids changing too many auth surfaces at once.

Cline

Experimental

Use the setup guide for a test connection. end-to-end certification is pending.

OpenCode

Experimental

Use the setup guide for a test connection. end-to-end certification is pending.

Receipts and errors.

Each successful response includes its request ID, requested and resolved model, token usage, cost, and remaining credits. Response headers include applicable rate limits.

402

Insufficient balance

Balance is exhausted (insufficient credits). Add credits from your console or reduce the request’s maximum output tokens.

429

Rate or concurrency

Honor Retry-After, reduce parallelism, and use jittered bounded backoff.

502 / 503

Model unavailable

Check the current model list, then retry later if the model is still unavailable.