|
1278 | 1278 | }, |
1279 | 1279 | "x-hideTryItPanel": true, |
1280 | 1280 | "x-codeSamples": [ |
| 1281 | + { |
| 1282 | + "lang": "cURL", |
| 1283 | + "source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/chat/completions' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"google/gemini-2.0-flash-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
| 1284 | + }, |
1281 | 1285 | { |
1282 | 1286 | "lang": "JavaScript", |
1283 | 1287 | "source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: 'google/gemini-2.0-flash-exp',\n messages:[\n {\n role:'user',\n content: 'Hello'\n }\n ],\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();" |
1284 | 1288 | }, |
1285 | 1289 | { |
1286 | 1290 | "lang": "Python", |
1287 | 1291 | "source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/chat/completions\",\n headers={\n \"Content-Type\":\"application/json\", \n \"Authorization\":\"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n \"model\":\"google/gemini-2.0-flash-exp\",\n \"messages\":[\n {\n \"role\":\"user\",\n \"content\":\"Hello\"\n }\n ],\n }\n)\n\ndata = response.json()\nprint(data)" |
1288 | | - }, |
1289 | | - { |
1290 | | - "lang": "cURL", |
1291 | | - "source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/chat/completions' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"google/gemini-2.0-flash-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
1292 | | - }, |
1293 | | - { |
1294 | | - "lang": "HTTP", |
1295 | | - "source": "POST /v1/chat/completions HTTP/1.1\nHost: api.aimlapi.com\nAuthorization: Bearer <YOUR_AIMLAPI_KEY>\nContent-Type: application/json\nAccept: */*\nContent-Length: 59\n\n{\n \"model\": \"google/gemini-2.0-flash-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n}" |
1296 | 1292 | } |
1297 | 1293 | ] |
1298 | 1294 | } |
|
2565 | 2561 | }, |
2566 | 2562 | "x-hideTryItPanel": true, |
2567 | 2563 | "x-codeSamples": [ |
| 2564 | + { |
| 2565 | + "lang": "cURL", |
| 2566 | + "source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/chat/completions' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"google/gemini-2.0-flash-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
| 2567 | + }, |
2568 | 2568 | { |
2569 | 2569 | "lang": "JavaScript", |
2570 | 2570 | "source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: 'google/gemini-2.0-flash-exp',\n messages:[\n {\n role:'user',\n content: 'Hello'\n }\n ],\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();" |
2571 | 2571 | }, |
2572 | 2572 | { |
2573 | 2573 | "lang": "Python", |
2574 | 2574 | "source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/chat/completions\",\n headers={\n \"Content-Type\":\"application/json\", \n \"Authorization\":\"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n \"model\":\"google/gemini-2.0-flash-exp\",\n \"messages\":[\n {\n \"role\":\"user\",\n \"content\":\"Hello\"\n }\n ],\n }\n)\n\ndata = response.json()\nprint(data)" |
2575 | | - }, |
2576 | | - { |
2577 | | - "lang": "cURL", |
2578 | | - "source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/chat/completions' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"google/gemini-2.0-flash-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
2579 | | - }, |
2580 | | - { |
2581 | | - "lang": "HTTP", |
2582 | | - "source": "POST /v1/chat/completions HTTP/1.1\nHost: api.aimlapi.com\nAuthorization: Bearer <YOUR_AIMLAPI_KEY>\nContent-Type: application/json\nAccept: */*\nContent-Length: 59\n\n{\n \"model\": \"google/gemini-2.0-flash-exp\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n}" |
2583 | 2575 | } |
2584 | 2576 | ] |
2585 | 2577 | } |
|
0 commit comments