Model API · v1

Model inference that belongs to your environment.

Use one environment-bound Runtime Key, an Anyhost-owned Model Catalog, protocol-native streaming, and exact Model Credit settlement.

One ResourcePer Project Environment
Three protocolsChat, Responses, Messages
No prompt storageContent stays off the ledger
Exact settlementUSD cost and Model Credits

Quickstart

Create once, inject on deploy.

Create a Model API Resource for an explicit environment. Confirm production intent before running the command; model create does not use --yes.

anyhost model create -e dev
anyhost model status -e dev
anyhost deploy -e dev
anyhost model test -e dev --model openai/gpt-5-mini

A ready Resource injects these server-side runtime values:

ANYHOST_MODEL_API_KEY
ANYHOST_MODEL_API_BASE_URL
ANYHOST_MODEL_API_RESOURCE_ID

The current Model API Base URL is public and already includes /v1:

https://models.anyhostcloud.com/v1

Use ANYHOST_MODEL_API_BASE_URL in application code so deployed environments receive the platform-managed value. The Runtime Key is never printed by the CLI and must not be placed in source, logs, browser bundles, or provider-branded variables.

anyhost model test runs a fixed, small, metered canary. It accepts a Catalog Model ID but no arbitrary prompt and returns only Generation and settlement status.

Rotation uses a bounded two-phase overlap: run anyhost model rotate-key -e dev, deploy and verify a real model request, then run the command again with --finalize. Finalization requires a successful post-rotation deployment and observed successor use before revoking the predecessor.

Catalog

Choose a released Catalog Model ID.

The authenticated Catalog is the authority for model identity, lifecycle, protocols, capabilities, context length, output limits, and customer reference price ceilings. Model IDs and display names preserve the published developer and model identity so people can find the model they intend to use. Every customer_prices entry includes an exact decimal price, currency, unit, and kind: ceiling. New active models become available to every ready Resource without editing each Resource.

curl -sS "https://models.anyhostcloud.com/v1/models" \
  -H "Authorization: Bearer $ANYHOST_MODEL_API_KEY"

Send an exact returned data[].id; do not derive an ID from the display name. Suspended models remain visible but are temporarily unavailable; deprecated models include replacement and sunset information. The Catalog does not expose the serving Provider, endpoint, private account cost, or adapter implementation.

Browse the same current publication without a Runtime Key →

Inference

Use the protocol your application needs.

GET  https://models.anyhostcloud.com/v1/models
POST https://models.anyhostcloud.com/v1/chat/completions
POST https://models.anyhostcloud.com/v1/responses
POST https://models.anyhostcloud.com/v1/messages
GET  https://models.anyhostcloud.com/v1/generation/{generation_id}

All calls use Authorization: Bearer <ANYHOST_MODEL_API_KEY>. Messages uses the same Bearer contract and does not require anthropic-version.

curl -sS "https://models.anyhostcloud.com/v1/chat/completions" \
  -H "Authorization: Bearer $ANYHOST_MODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "'"$MODEL_ID"'",
    "messages": [{"role":"user","content":"Hello"}]
  }'

The current adapter transparently forwards parameters it does not own, including caller-selected provider preferences, sampling controls, reasoning, tools, structured output, modalities, plugins, and server-tool fields. The required model is a top-level exact Anyhost Catalog Model ID; the optional sibling provider object only controls routing among Providers that can serve that model. Anyhost does not inject a universal output-token limit or overwrite your provider ordering. The live router and selected endpoint make the final request-time support decision.

Anyhost rejects active cross-model fallback through models/fallbacks, stored continuation through previous_response_id or stored prompt, background: true, and store: true. These controls conflict with one requested Model ID, one Generation, and content-free storage. Read the complete parameter boundary →

The public Anyhost OpenAPI is the authoritative request contract for Chat Completions, Responses, and Messages. Use those protocol schemas for field types and nested object shapes; use each model page for the model-level supported_parameters set.

JSON request bodies may be up to 50 MiB. Larger bodies return 413 request_too_large before inference.

Streaming

Consume native SSE without waiting for billing.

Set stream: true and process protocol events in order. Anyhost does not buffer the full output for settlement. Every admitted response includes x-anyhost-generation-id; the same public ID replaces private response IDs.

Usage and settlement

One hundred Model Credits represent one USD.

A final usage object reports the customer charge as decimal strings:

{
  "cost": "0.0015",
  "credits": "0.15",
  "settlement_status": "settled"
}

If settlement is still pending, cost and credits are null. Query GET /generation/{generation_id} with the same Resource key. Do not estimate a final customer charge from token counts in application code.

A Resource budget is independent from the Workspace balance:

anyhost model budget -e dev --credits 500 --period monthly
anyhost model budget -e dev --clear

Errors and retries

The caller owns retry decisions.

Chat Completions and Responses use an OpenAI-shaped error object; Messages uses a Messages-shaped error object. Branch on HTTP status and stable error.code, not message text.

Anyhost never automatically reissues inference. A caller retry creates a new Generation and may create a different output and another charge. Preserve safe Retry-After evidence when present and make product retries explicit.

Privacy boundary

Generation records contain usage, not content.

Anyhost does not persist model inputs or outputs. Generation records contain Resource attribution, lifecycle, content-free token and cache usage, charge, timestamps, and safe errors.