File tree Expand file tree Collapse file tree
shared/snippets/alibaba/create-image-to-video-generation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "title" : " Generate a video" ,
3+ "docs" : " https://docs.aimlapi.com/api-references/video-models/alibaba-cloud/" ,
4+ "payload" : {
5+ "baseUrl" : " https://api.aimlapi.com/v2" ,
6+ "apiKey" : " <YOUR_API_KEY>"
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ const main = async () => {
2+ const response = await fetch('{{ baseUrl }} /generate/video/alibaba/generation', {
3+ method: 'POST',
4+ headers: {
5+ Authorization: 'Bearer {{ apiKey }} ',
6+ 'Content-Type': 'application/json',
7+ },
8+ body: JSON.stringify({
9+ model: '{{ model }} ',
10+ prompt: 'Mona Lisa puts on glasses with her hands.',
11+ image_url: 'https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg',
12+ }),
13+ }).then((res) => res.json());
14+
15+ console.log('Generation:', response);
16+ };
17+
18+ main()
Original file line number Diff line number Diff line change 1+ import requests
2+
3+
4+ def main():
5+ url = "{{ baseUrl }} /generate/video/alibaba/generation"
6+ payload = {
7+ "model": "{{ model }} ",
8+ "prompt": "Mona Lisa puts on glasses with her hands.",
9+ "image_url": "https://s2-111386.kwimgs.com/bs2/mmu-aiplatform-temp/kling/20240620/1.jpeg",
10+ }
11+ headers = {"Authorization": "Bearer {{ apiKey }} ", "Content-Type": "application/json"}
12+
13+ response = requests.post(url, json=payload, headers=headers)
14+ print("Generation:", response.json())
15+
16+
17+ if __name__ == "__main__":
18+ main()
You can’t perform that action at this time.
0 commit comments