curl --request POST \ --url https://api.apimart.ai/v1/chat/completions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "gpt-4o", # Can be replaced with any supported model ID "messages": [ { "role": "system", "content": "You are a professional AI assistant." }, { "role": "user", "content": "Tell me about the history of artificial intelligence." } ] }'
{ "code": 200, "data": { "id": "chatcmpl-9876543210", "object": "chat.completion", "created": 1677652288, "model": "gpt-4o", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The history of artificial intelligence (AI) dates back to the 1950s...\n\n1. **Early Period (1950s-1960s)**: The proposal of the Turing Test marked the beginning of AI research...\n\n2. **Expert Systems Era (1970s-1980s)**: Rule-based systems began to be applied in medical diagnosis, financial analysis, and other fields...\n\n3. **Rise of Machine Learning (1990s-2000s)**: Statistical learning methods gradually became mainstream...\n\n4. **Deep Learning Revolution (2010s-Present)**: Breakthroughs in neural network technology brought explosive growth to AI..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 28, "completion_tokens": 320, "total_tokens": 348 } }}
Text Series
General Chat API (Default Streaming)
Unified chat API interface supporting all text generation models
Select different AI models via the model parameter
Compatible with OpenAI Chat Completions API format
POST
/
v1
/
chat
/
completions
curl --request POST \ --url https://api.apimart.ai/v1/chat/completions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "gpt-4o", # Can be replaced with any supported model ID "messages": [ { "role": "system", "content": "You are a professional AI assistant." }, { "role": "user", "content": "Tell me about the history of artificial intelligence." } ] }'
{ "code": 200, "data": { "id": "chatcmpl-9876543210", "object": "chat.completion", "created": 1677652288, "model": "gpt-4o", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The history of artificial intelligence (AI) dates back to the 1950s...\n\n1. **Early Period (1950s-1960s)**: The proposal of the Turing Test marked the beginning of AI research...\n\n2. **Expert Systems Era (1970s-1980s)**: Rule-based systems began to be applied in medical diagnosis, financial analysis, and other fields...\n\n3. **Rise of Machine Learning (1990s-2000s)**: Statistical learning methods gradually became mainstream...\n\n4. **Deep Learning Revolution (2010s-Present)**: Breakthroughs in neural network technology brought explosive growth to AI..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 28, "completion_tokens": 320, "total_tokens": 348 } }}
Use this file to discover all available pages before exploring further.
curl --request POST \ --url https://api.apimart.ai/v1/chat/completions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "gpt-4o", # Can be replaced with any supported model ID "messages": [ { "role": "system", "content": "You are a professional AI assistant." }, { "role": "user", "content": "Tell me about the history of artificial intelligence." } ] }'
{ "code": 200, "data": { "id": "chatcmpl-9876543210", "object": "chat.completion", "created": 1677652288, "model": "gpt-4o", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The history of artificial intelligence (AI) dates back to the 1950s...\n\n1. **Early Period (1950s-1960s)**: The proposal of the Turing Test marked the beginning of AI research...\n\n2. **Expert Systems Era (1970s-1980s)**: Rule-based systems began to be applied in medical diagnosis, financial analysis, and other fields...\n\n3. **Rise of Machine Learning (1990s-2000s)**: Statistical learning methods gradually became mainstream...\n\n4. **Deep Learning Revolution (2010s-Present)**: Breakthroughs in neural network technology brought explosive growth to AI..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 28, "completion_tokens": 320, "total_tokens": 348 } }}
All API endpoints require Bearer Token authenticationGet your API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
{ "model": "claude-3-5-sonnet", "messages": [ {"role": "system", "content": "You are a professional Python programming tutor"}, {"role": "user", "content": "How to use list comprehensions?"} ]}
{ "model": "gemini-2.0-flash", "messages": [ {"role": "user", "content": "What is machine learning?"}, {"role": "assistant", "content": "Machine learning is a branch of artificial intelligence..."}, {"role": "user", "content": "Can you give me an example?"} ]}