|
1305 | 1305 | }, |
1306 | 1306 | "x-hideTryItPanel": true, |
1307 | 1307 | "x-codeSamples": [ |
| 1308 | + { |
| 1309 | + "lang": "cURL", |
| 1310 | + "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\": \"bagoodex/bagoodex-search-v1\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
| 1311 | + }, |
1308 | 1312 | { |
1309 | 1313 | "lang": "JavaScript", |
1310 | 1314 | "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: 'bagoodex/bagoodex-search-v1',\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();" |
1311 | 1315 | }, |
1312 | 1316 | { |
1313 | 1317 | "lang": "Python", |
1314 | 1318 | "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\":\"bagoodex/bagoodex-search-v1\",\n \"messages\":[\n {\n \"role\":\"user\",\n \"content\":\"Hello\"\n }\n ],\n }\n)\n\ndata = response.json()\nprint(data)" |
1315 | | - }, |
1316 | | - { |
1317 | | - "lang": "cURL", |
1318 | | - "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\": \"bagoodex/bagoodex-search-v1\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
1319 | | - }, |
1320 | | - { |
1321 | | - "lang": "HTTP", |
1322 | | - "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\": \"bagoodex/bagoodex-search-v1\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n}" |
1323 | 1319 | } |
1324 | 1320 | ] |
1325 | 1321 | } |
|
2619 | 2615 | }, |
2620 | 2616 | "x-hideTryItPanel": true, |
2621 | 2617 | "x-codeSamples": [ |
| 2618 | + { |
| 2619 | + "lang": "cURL", |
| 2620 | + "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\": \"bagoodex/bagoodex-search-v1\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
| 2621 | + }, |
2622 | 2622 | { |
2623 | 2623 | "lang": "JavaScript", |
2624 | 2624 | "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: 'bagoodex/bagoodex-search-v1',\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();" |
2625 | 2625 | }, |
2626 | 2626 | { |
2627 | 2627 | "lang": "Python", |
2628 | 2628 | "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\":\"bagoodex/bagoodex-search-v1\",\n \"messages\":[\n {\n \"role\":\"user\",\n \"content\":\"Hello\"\n }\n ],\n }\n)\n\ndata = response.json()\nprint(data)" |
2629 | | - }, |
2630 | | - { |
2631 | | - "lang": "cURL", |
2632 | | - "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\": \"bagoodex/bagoodex-search-v1\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n }'" |
2633 | | - }, |
2634 | | - { |
2635 | | - "lang": "HTTP", |
2636 | | - "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\": \"bagoodex/bagoodex-search-v1\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello\"\n }\n ]\n}" |
2637 | 2629 | } |
2638 | 2630 | ] |
2639 | 2631 | } |
|
0 commit comments