AGTCloud API Docs
GuidesAPI ReferenceIntegrations and resourcesUpdate and help

Provider SDK migration

Integrate existing OpenAI, Anthropic, or Gemini SDK applications into AGTCloud and systematically check compatibility boundaries.

If an application already uses an OpenAI, Anthropic, or Gemini SDK, it can usually retain the SDK and application structure while pointing the client to the corresponding AGTCloud-compatible protocol. Migration involves more than replacing an address: authentication, model IDs, automatically appended paths, request fields, and response parsing must all be checked.

Keep the protocol consistent

OpenAI, Anthropic Messages, and Gemini Generate Content are different protocols. Replace service addresses only within the same protocol. If you also change protocols, treat the work as a full interface migration and test it accordingly.

Pre-migration inventory

First, record the actual capabilities of the current application, avoiding only verifying the simplest text requests.

Inspection itemsWhat needs to be recorded
SDKPackage name, language, version, and synchronous or asynchronous client
ProtocolChat Completions, Responses, Messages, or Generate Content
ModelThe current model ID, and whether there is a model whitelist in the code
InputText, images, files, system commands, and historical messages
OutputText shortcut properties, complete response objects, and custom parsing logic
StreamingEvent types, incremental splicing, and termination conditions
ToolsTool definition, call ID, parameter parsing, and result return
ReliabilityTimeout, retry, rate limiting, logging, and rollback strategies

Minimal changes

All three SDKs require the following configurations, but the method of filling them out is determined by the SDK.

ConfigurationMigration action
API addressUse the Origin or Base URL provided in the tutorial on this page to confirm whether the SDK automatically adds version paths
API KeyRead the AGTCloud API Key from the environment variable without writing it to the source code or repository
Model IDModels that are visible with the current API Key and support the target protocol
Request methodRetain the original protocol's Client methods, such as chat.completions.create or messages.create
Response readCheck text, tools, usage, and error structures against AGTCloud Reference

Migrate by SDK

The OpenAI SDK can call Chat Completions and Responses. The AGTCloud Base URL contains /v1.

Before the moveAfter the move
API Key of the original serviceAGTCLOUD_API_KEY Environment variables
The default address of the original service's Base URL or SDKhttps://api.agtcloud.cn/v1
Original model nameThe MODEL_ID available to the current API Key
Existing Chat or Responses methodsKeep the same Client method

Do not add /v1 repeatedly

https://api.agtcloud.cn/v1 already includes the API version path. Do not append another /v1, and do not enter a full endpoint such as /chat/completions or /responses.

For full installation, client initialization, and examples of Python and TypeScript, please refer to OpenAI SDK.

You can't just change three configurations

The following scenarios require adjusting business code rather than just replacing the Base URL, Key, and model:

  • The app changed from Chat Completions to Responses;
  • Application migration across protocols such as OpenAI, Anthropic, or Gemini;
  • Code directly depends on a specific SDK response class, convenience property, or streaming event;
  • Tool calls use protocol-specific definitions and result return structures;
  • Changes in multimodal content blocks, system instructions, or role names;
  • The SDK automatically stitches the path, while the original project passes in the complete endpoint URL;
  • Applications rely on native service-exclusive model discovery, file upload, or hosting tools.

Verify migration results

Verify a minimal text request

First, send a request that does not use streaming, tools, or multimodal content. Confirm that the request is sent to the expected API address and can read the text response.

Restoring the capacity needed for production

Restore item by item in the order of streaming, tool calls, structured output, multimodal and multi-turn states. Only one capability is added each time to facilitate differentiation.

Check for unsuccessful paths

At the very least, verify invalid API Keys, error model IDs, timeouts, rate limits, and connection interruptions. Ensure the application can read status codes and error messages without retrying indefinitely.

Compare business outcomes

Don't just check HTTP 200. Synchronize and compare text content, tool parameters, end reason, Usage, stream end condition, and Request ID in logs.

Phased switching and rollback

  1. Retain independent configurations for both new and old Providers, and do not scatter addresses and model names in business code.
  2. First, develop or test traffic using AGTCloud, then gradually expand the scope.
  3. Record success rates, delays, error types, and functional differences at each stage.
  4. Keep the original Provider configuration and controllable fallback switch, and clean up the old configuration after confirming stability.

Do not treat silent acceptance as support

Some compatible implementations accept unknown fields without applying the requested capability. Verify the actual output and response structure; an HTTP status alone does not prove that a field took effect.

Next

On this page