AnyInt Docs
Guides

Verify Your Integration

Run customer-facing checks before depending on AnyInt in production: model discovery, authentication, first requests, streaming, async tasks, callbacks, and error handling.

Use this guide before you ship an AnyInt integration. It is not a payment-style sandbox guide. AnyInt is an AI API platform, so verification means proving that your API key, model IDs, request format, streaming path, task polling, callback handling, and retry behavior work in your own environment.

Verification checklist

CheckWhy it matters
Store the API key in an environment variableAvoid leaking credentials in source code, logs, or screenshots
Call the Models API firstConfirm the exact model IDs available to your account
Make one minimal text requestVerify base URL, auth, JSON shape, and model access
Verify streaming if your UI streams outputConfirm your HTTP client handles SSE chunks and final completion
Verify provider-native APIs separatelyAnthropic and Gemini use different request bodies than OpenAI chat
Verify async media or music tasksInitial task creation is not the final generated asset
Verify callbacks if you use themYour endpoint must be reachable, fast, and idempotent
Handle 401, 403, 429, and transient upstream errorsProduction integrations need clear retry and user-facing error behavior

1. Configure the key safely

Use an environment variable instead of hardcoding the key.

export ANYINT_API_KEY="your-anyint-api-key"

Do not send API keys to browsers unless your product has a deliberate server-side mediation or short-lived-token design. Most production applications should call AnyInt from a backend service.

2. Discover model IDs

Call the Models API before hardcoding model names.

curl https://gateway.api.anyint.ai/openai/v1/models \
  -H "Authorization: Bearer $ANYINT_API_KEY"

Confirm that the response contains the model you plan to use:

{
  "data": [
    {
      "id": "claude-sonnet-4-6",
      "display_name": "Claude Sonnet 4.6"
    }
  ]
}

Use data[].id in later requests. Do not use a marketing label or a model ID copied from a different account without checking availability.

3. Make a minimal request

Start with the OpenAI-compatible Chat Completions API unless you need a provider-native request shape.

curl https://gateway.api.anyint.ai/openai/v1/chat/completions \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [
      {"role": "user", "content": "Reply with exactly: AnyInt OK"}
    ]
  }'

If this fails, check the model ID, API key, endpoint family, and auth header before trying larger payloads.

4. Verify streaming

If your product streams responses to users, verify that your HTTP client can read server-sent events.

curl https://gateway.api.anyint.ai/openai/v1/chat/completions \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "stream": true,
    "messages": [
      {"role": "user", "content": "Stream three short bullet points about API gateways."}
    ]
  }'

For OpenAI-compatible streaming, expect incremental chunks and a final stream terminator. Do not treat the first chunk as the full answer.

5. Verify provider-native request shapes

Provider-compatible APIs are useful when your application already speaks the provider's native format.

Anthropic-compatible example:

curl https://gateway.api.anyint.ai/anthropic/v1/messages \
  -H "x-api-key: $ANYINT_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 128,
    "messages": [
      {"role": "user", "content": "Explain token counting in one sentence."}
    ]
  }'

Gemini-compatible streaming example:

curl "https://gateway.api.anyint.ai/gemini/v1beta/models/gemini-3-flash-preview:streamGenerateContent?alt=sse" \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [{"text": "Stream a short answer about model routing."}]
      }
    ]
  }'

Do not mix request bodies across families. OpenAI uses messages, Anthropic uses Claude-style messages and content blocks, and Gemini uses contents[].parts[].

6. Verify async media or music tasks

For task-based APIs, store the returned task ID and poll the documented query route until the task succeeds or fails.

curl https://gateway.api.anyint.ai/dashscope/v1/services/aigc/video-generation/video-synthesis \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "happyhorse-1.0-t2v",
    "input": {
      "prompt": "A cinematic product reveal with soft camera movement.",
      "img_url": "https://your-domain.com/source-image.png"
    },
    "parameters": {
      "resolution": "720P",
      "duration": 5,
      "audio": false
    }
  }'

Poll with the returned task ID:

curl "https://gateway.api.anyint.ai/dashscope/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $ANYINT_API_KEY"

Only mark an asset ready after the result contains a success status and an output URL.

7. Verify callback handling

If an API accepts a callback URL, make the callback handler idempotent.

RequirementRecommendation
ReachabilityUse a public HTTPS URL that AnyInt can call
IdempotencyStore callback IDs or task IDs and safely ignore duplicates
SpeedReturn quickly and move heavy work to a queue
ValidationCheck that the task ID belongs to a task your application created
FallbackKeep polling available if a callback is delayed

8. Handle expected errors

HTTP statusTypical meaningIntegration behavior
400Invalid request body or missing required fieldFix the request before retrying
401Missing or invalid API keyAsk the operator to check the key and auth header
403Model, feature, or policy not availableCheck account access, model availability, or plan limits
429Rate or quota limit reachedBack off, retry later, or reduce concurrency
5xxTemporary upstream or gateway failureRetry with exponential backoff and surface a temporary failure

Read Errors and Limits for more detail.

Production readiness

Before launch, confirm:

  1. Your service stores ANYINT_API_KEY outside source control.
  2. Your application discovers or periodically refreshes available model IDs.
  3. Your first-choice model and fallback model are both enabled for the account.
  4. Streaming clients handle partial chunks, final chunks, and interrupted streams.
  5. Async task code stores task IDs and has retry-safe polling.
  6. Callback handlers are idempotent and have a polling fallback.
  7. User-facing errors distinguish invalid requests, auth problems, quota limits, and temporary failures.
  8. Logs do not contain API keys, private prompts, or generated private content unless your users explicitly consent.

On this page