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
| Check | Why it matters |
|---|---|
| Store the API key in an environment variable | Avoid leaking credentials in source code, logs, or screenshots |
| Call the Models API first | Confirm the exact model IDs available to your account |
| Make one minimal text request | Verify base URL, auth, JSON shape, and model access |
| Verify streaming if your UI streams output | Confirm your HTTP client handles SSE chunks and final completion |
| Verify provider-native APIs separately | Anthropic and Gemini use different request bodies than OpenAI chat |
| Verify async media or music tasks | Initial task creation is not the final generated asset |
| Verify callbacks if you use them | Your endpoint must be reachable, fast, and idempotent |
Handle 401, 403, 429, and transient upstream errors | Production 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.
| Requirement | Recommendation |
|---|---|
| Reachability | Use a public HTTPS URL that AnyInt can call |
| Idempotency | Store callback IDs or task IDs and safely ignore duplicates |
| Speed | Return quickly and move heavy work to a queue |
| Validation | Check that the task ID belongs to a task your application created |
| Fallback | Keep polling available if a callback is delayed |
8. Handle expected errors
| HTTP status | Typical meaning | Integration behavior |
|---|---|---|
400 | Invalid request body or missing required field | Fix the request before retrying |
401 | Missing or invalid API key | Ask the operator to check the key and auth header |
403 | Model, feature, or policy not available | Check account access, model availability, or plan limits |
429 | Rate or quota limit reached | Back off, retry later, or reduce concurrency |
5xx | Temporary upstream or gateway failure | Retry with exponential backoff and surface a temporary failure |
Read Errors and Limits for more detail.
Production readiness
Before launch, confirm:
- Your service stores
ANYINT_API_KEYoutside source control. - Your application discovers or periodically refreshes available model IDs.
- Your first-choice model and fallback model are both enabled for the account.
- Streaming clients handle partial chunks, final chunks, and interrupted streams.
- Async task code stores task IDs and has retry-safe polling.
- Callback handlers are idempotent and have a polling fallback.
- User-facing errors distinguish invalid requests, auth problems, quota limits, and temporary failures.
- Logs do not contain API keys, private prompts, or generated private content unless your users explicitly consent.